({ label, value, colorName = label, textValue }: ColorItemProps)
| 232 | } |
| 233 | |
| 234 | function ColorItem({ label, value, colorName = label, textValue }: ColorItemProps) { |
| 235 | const { copied, copy } = useClipboard() |
| 236 | return ( |
| 237 | <CommandMenuItem onAction={() => copy(value)} textValue={textValue}> |
| 238 | <ColorSwatch |
| 239 | className="mt-0.5 mr-2 [--color-swatch-size:--spacing(5)]" |
| 240 | color={formatHex(parse(value))} |
| 241 | colorName={colorName} |
| 242 | /> |
| 243 | <CommandMenuLabel>{label}</CommandMenuLabel> |
| 244 | <CommandMenuDescription className="text-xs tracking-tight"> |
| 245 | <span |
| 246 | className={twJoin( |
| 247 | 'absolute inset-y-0 right-2 left-0 self-center justify-self-end font-mono focus:transition focus:duration-300', |
| 248 | copied ? '-translate-y-1.5 opacity-0' : 'translate-y-0 opacity-100' |
| 249 | )} |
| 250 | > |
| 251 | {value} |
| 252 | </span> |
| 253 | <span |
| 254 | className={twJoin( |
| 255 | 'absolute inset-y-0 right-2 left-0 gap-x-1 self-center justify-self-end transition duration-300', |
| 256 | copied ? 'translate-y-0 opacity-100' : 'translate-y-1.5 opacity-0' |
| 257 | )} |
| 258 | > |
| 259 | Copied |
| 260 | </span> |
| 261 | </CommandMenuDescription> |
| 262 | </CommandMenuItem> |
| 263 | ) |
| 264 | } |
nothing calls this directly
no test coverage detected