"use client"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Button } from "@/components/ui/button"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import { Switch } from "@/components/ui/switch"; import { Trash2 } from "lucide-react"; import { useBarcodeDesigner } from "@/contexts/BarcodeDesignerContext"; import { BarcodeLabelComponent } from "@/types/barcode"; export function BarcodeDesignerRightPanel() { const { components, selectedComponentId, updateComponent, removeComponent, selectComponent, widthMm, heightMm, setWidthMm, setHeightMm, } = useBarcodeDesigner(); const selected = components.find((c) => c.id === selectedComponentId); if (!selected) { return (

요소를 선택하면 속성을 편집할 수 있습니다.

setWidthMm(Number(e.target.value) || 50)} /> × setHeightMm(Number(e.target.value) || 30)} />
); } const update = (updates: Partial) => updateComponent(selected.id, updates); return (
속성
update({ x: Number(e.target.value) || 0 })} />
update({ y: Number(e.target.value) || 0 })} />
update({ width: Number(e.target.value) || 10 })} />
update({ height: Number(e.target.value) || 10 })} />
{selected.type === "text" && ( <>
update({ content: e.target.value })} placeholder="텍스트" />
update({ fontSize: Number(e.target.value) || 10 })} />
update({ fontColor: e.target.value })} className="h-9 w-20 p-1" />
)} {selected.type === "barcode" && ( <>
update({ barcodeValue: e.target.value })} placeholder="123456789" />
update({ showBarcodeText: v })} />
)} {selected.type === "line" && ( <>
update({ lineWidth: Number(e.target.value) || 1 })} />
update({ lineColor: e.target.value })} className="h-9 w-20 p-1" />
)} {selected.type === "rectangle" && ( <>
update({ lineWidth: Number(e.target.value) || 0 })} />
update({ lineColor: e.target.value })} className="h-9 w-20 p-1" />
update({ backgroundColor: e.target.value })} className="h-9 w-20 p-1" />
)} {selected.type === "image" && (
update({ imageUrl: e.target.value })} placeholder="https://..." />

또는 나중에 업로드 기능 연동

)}
); }