-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add copy to clipboard icon #1200
Add copy to clipboard icon #1200
Conversation
<> | ||
<div style={{ display: 'flex', justifyContent: 'flex-end' }}> | ||
<CopyToClipboard text={snippet} onCopy={() => toast.success('Copied to clipboard!')}> | ||
<FontAwesomeIcon icon={faCopy} style={{ cursor: 'pointer' }} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on contributing.md
file Bruno is using Tabler icons, so probably should be replaced with Tabler icon to not mix icons from different collections.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree
What do you think about the following styling? Recording.2023-12-13.004345.mp4 |
I'm not really a react dev, so I have know idea how to do it. It's true that I never changed the layout theme. |
I just slightly modified <StyledWrapper>
<CopyToClipboard className="copy-to-clipboard" text={snippet} onCopy={() => toast.success('Copied to clipboard!')}>
<IconCopy size={20} strokeWidth={1.5}/>
</CopyToClipboard>
<CodeEditor
readOnly
value={snippet}
font={get(preferences, 'font.codeFont', 'default')}
theme={storedTheme}
mode={lang}
/>
</StyledWrapper> introduced new StyledWrapper for that component: import styled from 'styled-components';
const StyledWrapper = styled.div`
position: relative;
.copy-to-clipboard {
position: absolute;
cursor: pointer;
top: 10px;
right: 10px;
z-index: 10;
opacity: 0.5;
&:hover {
opacity: 1;
}
}
`;
export default StyledWrapper; |
@martinsefcik Thanks a lot for the help. It's really appreciated. |
Thank you so much @survivant @martinsefcik ! |
Description
I added the copy to clipboard feature
Contribution Checklist:
Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.
Publishing to New Package Managers
Please see here for more information.