"use client"; import { useEffect, useState } from "react"; import { useTheme } from "@lynkd/messaging-inbox-sdk"; import { useUi } from "@/lib/ui-state"; import { X, RotateCcw, Sun, Moon, Monitor, Check } from "lucide-react"; import clsx from "clsx"; const ACCENTS = ["#FDA913", "#5b9dff", "#3ecf8e", "#bb98ff", "#f2555a", "#ff7a3d", "#54e7ff", "#f5b544"]; const RADII = [ { label: "Sharp", card: "8px", control: "6px" }, { label: "Default", card: "20px", control: "10px" }, { label: "Round", card: "28px", control: "14px" }, ]; const GRADIENTS = [ "linear-gradient(135deg, #FDA913 0%, #ff7a3d 55%, #ff4d6d 100%)", "linear-gradient(135deg, #5b9dff 0%, #bb98ff 100%)", "linear-gradient(135deg, #3ecf8e 0%, #54e7ff 100%)", "linear-gradient(135deg, #f2555a 0%, #ff7a3d 100%)", ]; type Mode = "light" | "dark" | "system"; export function ThemingPanel() { const { themingOpen, setThemingOpen } = useUi(); const { theme, scheme, setScheme, setThemeOverrides, resetTheme } = useTheme(); const [mode, setMode] = useState(scheme); // when in "system" mode, follow OS changes live useEffect(() => { if (mode !== "system" || typeof window === "undefined") return; const mq = window.matchMedia("(prefers-color-scheme: dark)"); const apply = () => setScheme(mq.matches ? "dark" : "light"); apply(); mq.addEventListener("change", apply); return () => mq.removeEventListener("change", apply); }, [mode, setScheme]); if (!themingOpen) return null; const activeAccent = scheme === "light" ? theme.light.accent : theme.dark.accent; const pickMode = (m: Mode) => { setMode(m); if (m !== "system") setScheme(m); }; return (
setThemingOpen(false)}>
e.stopPropagation()}>
Appearance
Live theme — persists to this browser
{([{ v: "light", icon: Sun, label: "Light" }, { v: "dark", icon: Moon, label: "Dark" }, { v: "system", icon: Monitor, label: "System" }] as const).map((m) => ( ))}
{ACCENTS.map((c) => ( ))}
{RADII.map((r) => ( ))}
{GRADIENTS.map((g) => (
All tokens here are also settable at build time via NEXT_PUBLIC_THEME_* env vars. See docs/THEMING.md.
); } function Group({ title, children }: { title: string; children: React.ReactNode }) { return (
{title}
{children}
); }