import { CheckIcon } from "lucide-react" import { useMemo } from "react" import { useCanvasStore } from "../store/canvasStore" import { STYLE_PRESETS } from "../styles-presets" export default function Styles({ onClose, onSelectStyle, activeStyleId, }: { onClose: () => void onSelectStyle: (styleId: string) => void activeStyleId: string }) { const { boxes, selectedBoxId } = useCanvasStore() const active = useMemo( () => boxes.find((box) => box.id === selectedBoxId) ?? null, [boxes, selectedBoxId] ) if (!active) { return (
Select a box to choose a style.
) } return (
Choose a style
{STYLE_PRESETS.map((preset) => { const currentId = activeStyleId ?? active.styleId ?? "default" const isActive = currentId === preset.id return ( ) })}
) }