mirror of
https://github.com/usebruno/bruno.git
synced 2024-12-22 23:02:40 +01:00
Add copy to clipboard icon
This commit is contained in:
parent
8ddec6bf0c
commit
89c5fc2f03
@ -55,6 +55,7 @@
|
||||
"qs": "^6.11.0",
|
||||
"query-string": "^7.0.1",
|
||||
"react": "18.2.0",
|
||||
"react-copy-to-clipboard": "^5.1.0",
|
||||
"react-dnd": "^16.0.1",
|
||||
"react-dnd-html5-backend": "^16.0.1",
|
||||
"react-dom": "18.2.0",
|
||||
|
@ -4,6 +4,10 @@ import { HTTPSnippet } from 'httpsnippet';
|
||||
import { useTheme } from 'providers/Theme/index';
|
||||
import { buildHarRequest } from 'utils/codegenerator/har';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { CopyToClipboard } from 'react-copy-to-clipboard';
|
||||
import toast from 'react-hot-toast';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { faCopy } from '@fortawesome/free-solid-svg-icons';
|
||||
|
||||
const CodeView = ({ language, item }) => {
|
||||
const { storedTheme } = useTheme();
|
||||
@ -20,6 +24,12 @@ const CodeView = ({ language, item }) => {
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
|
||||
<CopyToClipboard text={snippet} onCopy={() => toast.success('Copied to clipboard!')}>
|
||||
<FontAwesomeIcon icon={faCopy} style={{ cursor: 'pointer' }} />
|
||||
</CopyToClipboard>
|
||||
</div>
|
||||
<CodeEditor
|
||||
readOnly
|
||||
value={snippet}
|
||||
@ -27,6 +37,7 @@ const CodeView = ({ language, item }) => {
|
||||
theme={storedTheme}
|
||||
mode={lang}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user