"use client" import { Button } from "@/components/ui/button" import { cn } from "@/lib/utils" import type { TemplateContent, TemplateDefinition } from "../../../lib/types" import { Toggle } from "./toggle" type ThemePatch = Partial> function Heading({ title, text }: { title: string; text?: string }) { return (

{title}

{text &&

{text}

}
) } export function DesignPanel({ def, content, onChange }: { def: TemplateDefinition content: TemplateContent onChange: (patch: ThemePatch) => void }) { const palette = def.palettes.find((p) => p.key === content.palette) ?? def.palettes[0] const accent = content.accent || palette.accent return (
{def.palettes.map((p) => ( ))}
onChange({ accent: event.target.value })} className="h-10 w-14 cursor-pointer rounded-md border bg-transparent p-1" /> {accent} {content.accent && ( )}
{def.fonts.map((pair) => ( ))}
{def.sections.filter((section) => section.optional).map((section) => ( onChange({ hidden: visible ? content.hidden.filter((key) => key !== section.key) : [...content.hidden, section.key], }) } > {section.label} ))}
) }