"use client"; import React, { useState } from "react"; import { useYuukiTheme, type ThemeMode } from "@/lib/theme-context"; import { Sun, Moon, Palette, X, Check } from "lucide-react"; import { cn } from "@/lib/utils"; const PRESET_COLORS = [ "#ff6b6b", "#ffa07a", "#ffd93d", "#6bcb77", "#4d96ff", "#9b59b6", "#ff69b4", "#00d2d3", "#f8b500", "#ffffff", "#0a0a0a", "#c08b6e", ]; const MODES: { id: ThemeMode; label: string; icon: React.ElementType }[] = [ { id: "light", label: "Light", icon: Sun }, { id: "dark", label: "Dark", icon: Moon }, { id: "pastel", label: "Pastel", icon: Palette }, ]; interface ThemePanelProps { open: boolean; onClose: () => void; } export function ThemePanel({ open, onClose }: ThemePanelProps) { const { mode, setMode, accentColor, setAccentColor } = useYuukiTheme(); const [customHex, setCustomHex] = useState(accentColor); const handleHexChange = (val: string) => { setCustomHex(val); if (/^#[0-9a-fA-F]{6}$/.test(val)) { setAccentColor(val); } }; if (!open) return null; return (
{/* Title bar */}
theme settings
{/* Mode selection */}
{MODES.map((m) => { const Icon = m.icon; return ( ); })}
{/* Accent color */}
{PRESET_COLORS.map((color) => ( ))}
{/* Custom hex input with color picker */}
handleHexChange(e.target.value)} className="h-10 w-10 cursor-pointer rounded-lg border border-border bg-transparent p-0.5" />
handleHexChange(e.target.value)} placeholder="#ff6b6b" maxLength={7} className="flex-1 rounded-lg border border-border bg-background px-3 py-2 text-sm font-mono text-foreground placeholder:text-muted-foreground/50 focus:outline-none focus:ring-2 focus:ring-ring/20" />
{/* Preview */}
Yuuki Chat
{accentColor}
); }