import { useRef } from "react"; import { Button } from "@/components/ui/button"; import type { LogoPosition } from "@/lib/types"; const LOGO_POSITIONS: { value: LogoPosition; label: string }[] = [ { value: "top_right", label: "Top right" }, { value: "top_left", label: "Top left" }, { value: "bottom_right", label: "Bottom right" }, { value: "bottom_left", label: "Bottom left" }, ]; interface LogoEditorProps { logo: string | null; logoPosition: LogoPosition; logoOpacity: number; onLogoChange: (logo: string | null) => void; onPositionChange: (position: LogoPosition) => void; onOpacityChange: (opacity: number) => void; } export function LogoEditor({ logo, logoPosition, logoOpacity, onLogoChange, onPositionChange, onOpacityChange, }: LogoEditorProps) { const fileInputRef = useRef(null); const handleFile = (e: React.ChangeEvent) => { const file = e.target.files?.[0]; if (!file) return; const reader = new FileReader(); reader.onload = (ev) => { const result = ev.target?.result; if (typeof result === "string") onLogoChange(result); }; reader.readAsDataURL(file); e.target.value = ""; }; return (
{logo && ( )}