'use client'; import React from 'react'; import type { DropdownMenuItemProps } from '@radix-ui/react-dropdown-menu'; import { cn } from '@udecode/cn'; import { Check } from 'lucide-react'; import { buttonVariants } from './button'; import { DropdownMenuItem } from './dropdown-menu'; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from './tooltip'; export type TColor = { isBrightColor: boolean; name: string; value: string; }; type ColorDropdownMenuItemProps = { isBrightColor: boolean; isSelected: boolean; value: string; updateColor: (color: string) => void; name?: string; } & DropdownMenuItemProps; export function ColorDropdownMenuItem({ className, isBrightColor, isSelected, name, updateColor, value, ...props }: ColorDropdownMenuItemProps) { const content = ( { e.preventDefault(); updateColor(value); }} {...props} > {isSelected ? : null} ); return name ? ( {content} {name} ) : ( content ); } type ColorDropdownMenuItemsProps = { colors: TColor[]; updateColor: (color: string) => void; color?: string; } & React.HTMLAttributes; export function ColorDropdownMenuItems({ className, color, colors, updateColor, ...props }: ColorDropdownMenuItemsProps) { return ( {colors.map(({ isBrightColor, name, value }) => ( ))} {props.children} ); }