diff --git a/components/DrawingSettings.tsx b/components/DrawingSettings.tsx new file mode 100644 index 0000000..27575d1 --- /dev/null +++ b/components/DrawingSettings.tsx @@ -0,0 +1,268 @@ +"use client"; + +import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; +import { Label } from "@/components/ui/label"; +import { Input } from "@/components/ui/input"; +import { Textarea } from "@/components/ui/textarea"; +import { Button } from "@/components/ui/button"; +import { Trash2, Palette } from "lucide-react"; +import { Slider } from "@/components/ui/slider"; +import { Checkbox } from "@/components/ui/checkbox"; +import { FreehandDrawingData } from "./FreehandDrawingNode"; +import { ShapeData } from "./ShapeNode"; +import { TextAnnotationData } from "./TextAnnotationNode"; + +const colorPresets = [ + "#000000", "#FF0000", "#00FF00", "#0000FF", + "#FFFF00", "#FF00FF", "#00FFFF", "#FFA500", + "#800080", "#008080", "#808080", "#FFFFFF" +]; + +interface DrawingSettingsProps { + isOpen: boolean; + setIsOpen: (open: boolean) => void; + id: string; + data: FreehandDrawingData | ShapeData | TextAnnotationData; + type: "freehand" | "shape" | "text"; + handleLabelChange: (e: React.ChangeEvent) => void; + handleNotesChange: (e: React.ChangeEvent) => void; + handleColorChange?: (color: string) => void; + handleFillColorChange?: (fillColor: string) => void; + handleFilledChange?: (filled: boolean) => void; + handleStrokeWidthChange?: (width: number) => void; + handleTextChange?: (e: React.ChangeEvent) => void; + handleBackgroundColorChange?: (color: string) => void; + handleFontSizeChange?: (size: number) => void; + handleFontWeightChange?: (weight: "normal" | "bold") => void; + handleDelete: () => void; +} + +export default function DrawingSettings({ + isOpen, + setIsOpen, + id, + data, + type, + handleLabelChange, + handleNotesChange, + handleColorChange, + handleFillColorChange, + handleFilledChange, + handleStrokeWidthChange, + handleTextChange, + handleBackgroundColorChange, + handleFontSizeChange, + handleFontWeightChange, + handleDelete, +}: DrawingSettingsProps) { + return ( + + +
+ + +
+
+ + +
+ + {type === "text" && handleTextChange && ( +
+ +