"use client"; import { useState, useEffect } from "react"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import { Separator } from "@/components/ui/separator"; import { Palette, Type, Square, Box } from "lucide-react"; import { ComponentStyle } from "@/types/screen"; interface StyleEditorProps { style: ComponentStyle; onStyleChange: (style: ComponentStyle) => void; className?: string; } export default function StyleEditor({ style, onStyleChange, className }: StyleEditorProps) { const [localStyle, setLocalStyle] = useState(style || {}); useEffect(() => { setLocalStyle(style || {}); }, [style]); const handleStyleChange = (property: keyof ComponentStyle, value: any) => { const newStyle = { ...localStyle, [property]: value }; setLocalStyle(newStyle); onStyleChange(newStyle); }; return (
{/* 여백 섹션 */}

여백

handleStyleChange("margin", e.target.value)} className="h-8" />
handleStyleChange("padding", e.target.value)} className="h-8" />
handleStyleChange("gap", e.target.value)} className="h-8" />
{/* 테두리 섹션 */}

테두리

handleStyleChange("borderWidth", e.target.value)} className="h-8" />
handleStyleChange("borderColor", e.target.value)} className="h-8 w-14 p-1" /> handleStyleChange("borderColor", e.target.value)} placeholder="#000000" className="h-8 flex-1" />
handleStyleChange("borderRadius", e.target.value)} className="h-8" />
{/* 배경 섹션 */}

배경

handleStyleChange("backgroundColor", e.target.value)} className="h-8 w-14 p-1" /> handleStyleChange("backgroundColor", e.target.value)} placeholder="#ffffff" className="h-8 flex-1" />
handleStyleChange("backgroundImage", e.target.value)} className="h-8" />
{/* 텍스트 섹션 */}

텍스트

handleStyleChange("color", e.target.value)} className="h-8 w-14 p-1" /> handleStyleChange("color", e.target.value)} placeholder="#000000" className="h-8 flex-1" />
handleStyleChange("fontSize", e.target.value)} className="h-8" />
); }