MCPcopy
hub / github.com/intentui/intentui / ColorItem

Function ColorItem

src/components/command-palette.tsx:234–264  ·  view source on GitHub ↗
({ label, value, colorName = label, textValue }: ColorItemProps)

Source from the content-addressed store, hash-verified

232}
233
234function 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}

Callers

nothing calls this directly

Calls 2

useClipboardFunction · 0.90
copyFunction · 0.85

Tested by

no test coverage detected