-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: add copy to clipboard to node detail links (#8)
* feat: add CopyToClipboardIcon component * feat: add copy to clipboard in node detail links
- Loading branch information
Showing
8 changed files
with
55 additions
and
8 deletions.
There are no files selected for viewing
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,13 @@ | ||
import { memo } from 'react' | ||
import { useCopyToClipboardAndNotify } from '@aleph-front/core' | ||
import { StyledCopytoClipboardIcon } from './styles' | ||
import { CopyToClipboardIconProps } from './types' | ||
|
||
export const CopytoClipboardIcon = ({ text }: CopyToClipboardIconProps) => { | ||
const handleCopy = useCopyToClipboardAndNotify(text || '') | ||
|
||
return <StyledCopytoClipboardIcon name="copy" onClick={handleCopy} /> | ||
} | ||
CopytoClipboardIcon.displayName = 'CopytoClipboardIcon' | ||
|
||
export default memo(CopytoClipboardIcon) |
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 { default } from './cmp' |
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,16 @@ | ||
import { Icon } from '@aleph-front/core' | ||
import styled, { css } from 'styled-components' | ||
import tw from 'twin.macro' | ||
|
||
export const StyledCopytoClipboardIcon = styled(Icon)` | ||
${({ theme }) => css` | ||
${tw`cursor-pointer`} | ||
transition-property: color; | ||
transition-duration: ${theme.transition.duration.fast}ms; | ||
transition-timing-function: ${theme.transition.timing}; | ||
&:hover { | ||
color: ${theme.color.main0}; | ||
} | ||
`} | ||
` |
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,3 @@ | ||
export type CopyToClipboardIconProps = { | ||
text?: string | ||
} |
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
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