mirror of
https://github.com/usebruno/bruno.git
synced 2025-06-21 04:08:01 +02:00
And adding style to GenCode
This commit is contained in:
parent
c2c2ef6e2b
commit
f8ff305cf4
@ -0,0 +1,20 @@
|
|||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
const StyledWrapper = styled.div`
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.copy-to-clipboard {
|
||||||
|
position: absolute;
|
||||||
|
cursor: pointer;
|
||||||
|
top: 0px;
|
||||||
|
right: 0px;
|
||||||
|
z-index: 10;
|
||||||
|
opacity: 0.5;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export default StyledWrapper;
|
@ -2,6 +2,7 @@ import CodeEditor from 'components/CodeEditor/index';
|
|||||||
import get from 'lodash/get';
|
import get from 'lodash/get';
|
||||||
import { HTTPSnippet } from 'httpsnippet';
|
import { HTTPSnippet } from 'httpsnippet';
|
||||||
import { useTheme } from 'providers/Theme/index';
|
import { useTheme } from 'providers/Theme/index';
|
||||||
|
import StyledWrapper from './StyledWrapper';
|
||||||
import { buildHarRequest } from 'utils/codegenerator/har';
|
import { buildHarRequest } from 'utils/codegenerator/har';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
import { CopyToClipboard } from 'react-copy-to-clipboard';
|
import { CopyToClipboard } from 'react-copy-to-clipboard';
|
||||||
@ -24,18 +25,22 @@ const CodeView = ({ language, item }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
|
<StyledWrapper>
|
||||||
<CopyToClipboard text={snippet} onCopy={() => toast.success('Copied to clipboard!')}>
|
<CopyToClipboard
|
||||||
|
className="copy-to-clipboard"
|
||||||
|
text={snippet}
|
||||||
|
onCopy={() => toast.success('Copied to clipboard!')}
|
||||||
|
>
|
||||||
<IconCopy size={25} strokeWidth={1.5} />
|
<IconCopy size={25} strokeWidth={1.5} />
|
||||||
</CopyToClipboard>
|
</CopyToClipboard>
|
||||||
</div>
|
<CodeEditor
|
||||||
<CodeEditor
|
readOnly
|
||||||
readOnly
|
value={snippet}
|
||||||
value={snippet}
|
font={get(preferences, 'font.codeFont', 'default')}
|
||||||
font={get(preferences, 'font.codeFont', 'default')}
|
theme={storedTheme}
|
||||||
theme={storedTheme}
|
mode={lang}
|
||||||
mode={lang}
|
/>
|
||||||
/>
|
</StyledWrapper>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user