"use client" import { useId } from "react" import { ChevronDownIcon, ChevronUpIcon, PlusIcon, Trash2Icon } from "lucide-react" import { Button } from "@/components/ui/button" import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible" import { Field, FieldDescription, FieldLabel } from "@/components/ui/field" import { Input } from "@/components/ui/input" import { Textarea } from "@/components/ui/textarea" import type { FieldDef, ListFieldDef, ListItem, TemplateData, TemplateDefinition } from "../../../lib/types" const MAX_ITEMS = 40 export function ContentPanel({ def, data, hidden, onChange }: { def: TemplateDefinition data: TemplateData hidden: string[] onChange: (section: string, field: string, value: string | ListItem[]) => void }) { return (
{def.sections.map((section, index) => ( // Im Baukasten stehen die Bausteine im Vordergrund – „Marke & Kontakt“ startet zugeklappt {section.label} {hidden.includes(section.key) && ( ausgeblendet )}
{section.fields.map((field) => field.type === "list" ? ( onChange(section.key, field.key, items)} /> ) : ( onChange(section.key, field.key, value)} /> ) )}
))}
) } export function FieldInput({ field, value, onChange }: { field: FieldDef; value: string; onChange: (value: string) => void }) { const id = useId() return ( {field.label} {field.type === "textarea" ? (