({
isCopied,
isHovered,
leadingSpace,
})
| 75 | * Displays a dimmed icon that expands on hover and changes to a checkmark when copied. |
| 76 | */ |
| 77 | const CopyIcon: React.FC<CopyIconProps> = ({ |
| 78 | isCopied, |
| 79 | isHovered, |
| 80 | leadingSpace, |
| 81 | }) => { |
| 82 | const theme = useTheme() |
| 83 | const text = getCopyIconText(isCopied, isHovered, leadingSpace) |
| 84 | |
| 85 | if (isCopied) { |
| 86 | return <span fg="green">{text}</span> |
| 87 | } |
| 88 | |
| 89 | if (isHovered) { |
| 90 | return <span fg={theme.foreground}>{text}</span> |
| 91 | } |
| 92 | |
| 93 | return ( |
| 94 | <span fg={theme.muted} attributes={TextAttributes.DIM}> |
| 95 | {text} |
| 96 | </span> |
| 97 | ) |
| 98 | } |
| 99 | |
| 100 | interface CopyButtonProps { |
| 101 | /** The text to copy to clipboard when clicked */ |
nothing calls this directly
no test coverage detected