-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added SVGs for Copy and Paste buttons - Created individual components to handle SVGs. - Created copy-pasted-button
- Loading branch information
Showing
11 changed files
with
103 additions
and
4 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export const CopyIcon = () => { | ||
return ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
width="1.2em" | ||
height="1.2em" | ||
viewBox="0 0 256 256" | ||
> | ||
<path | ||
fill="currentColor" | ||
d="M216 32H88a8 8 0 0 0-8 8v40H40a8 8 0 0 0-8 8v128a8 8 0 0 0 8 8h128a8 8 0 0 0 8-8v-40h40a8 8 0 0 0 8-8V40a8 8 0 0 0-8-8m-56 176H48V96h112Zm48-48h-32V88a8 8 0 0 0-8-8H96V48h112Z" | ||
/> | ||
</svg> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export const PasteIcon = () => { | ||
return ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
width="1.2em" | ||
height="1.2em" | ||
viewBox="0 0 256 256" | ||
> | ||
<path | ||
fill="currentColor" | ||
d="M200 32h-36.26a47.92 47.92 0 0 0-71.48 0H56a16 16 0 0 0-16 16v168a16 16 0 0 0 16 16h144a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16m-72 0a32 32 0 0 1 32 32H96a32 32 0 0 1 32-32m72 184H56V48h26.75A47.9 47.9 0 0 0 80 64v8a8 8 0 0 0 8 8h80a8 8 0 0 0 8-8v-8a47.9 47.9 0 0 0-2.75-16H200Z" | ||
/> | ||
</svg> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/pods/toolbar/components/copy-paste-button/copy-paste-button.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { CopyIcon, PasteIcon } from '@/common/components/icons'; | ||
import { ToolbarButton } from '../toolbar-button'; | ||
import classes from '@/pods/toolbar/toolbar.pod.module.css'; | ||
import { useCanvasContext } from '@/core/providers'; | ||
import { SHORTCUTS } from '../../shortcut/shortcut.const'; | ||
import { useClipboard } from '@/pods/canvas/use-clipboard.hook'; | ||
|
||
export const CopyButton = () => { | ||
const { selectionInfo } = useCanvasContext(); | ||
const { copyShapeToClipboard, pasteShapeFromClipboard } = useClipboard(); | ||
|
||
const handleCopyClick = () => { | ||
if (selectionInfo.selectedShapeId) { | ||
copyShapeToClipboard(); | ||
} | ||
}; | ||
|
||
const handlePasteClick = () => { | ||
pasteShapeFromClipboard(); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<ul className={classes.buttonGroup}> | ||
<li> | ||
<ToolbarButton | ||
icon={<CopyIcon />} | ||
label="Copy" | ||
onClick={handleCopyClick} | ||
className={classes.button} | ||
disabled={!selectionInfo.selectedShapeId} | ||
shortcutOptions={SHORTCUTS.copy} | ||
/> | ||
</li> | ||
<li> | ||
<ToolbarButton | ||
icon={<PasteIcon />} | ||
label="Paste" | ||
onClick={handlePasteClick} | ||
className={classes.button} | ||
shortcutOptions={SHORTCUTS.paste} | ||
/> | ||
</li> | ||
</ul> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './copy-paste-button'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters