import { useEffect, useState } from "react"; import { X, ExternalLink } from "lucide-react"; import { FAMILIES, THEMES } from "@/lib/themes"; import { applyTheme, getStoredThemeId } from "@/lib/themes/engine"; import { ANIMATION_IDS, ANIMATION_LABELS, type AnimationId } from "@/lib/animations"; const footerLinks = [ { href: "mailto:contact@timmypidashev.dev", label: "Contact", color: "text-green", activeBg: "bg-green/15", activeBorder: "border-green/40" }, { href: "https://github.com/timmypidashev", label: "Github", color: "text-yellow", activeBg: "bg-yellow/15", activeBorder: "border-yellow/40" }, { href: "https://www.linkedin.com/in/timothy-pidashev-4353812b8", label: "LinkedIn", color: "text-blue", activeBg: "bg-blue/15", activeBorder: "border-blue/40" }, { href: "https://github.com/timmypidashev/web", label: "Source", color: "text-purple", activeBg: "bg-purple/15", activeBorder: "border-purple/40" }, ]; const animOptions = [ { id: "shuffle", color: "text-red-bright", activeBg: "bg-red-bright/15", activeBorder: "border-red-bright/40" }, { id: "game-of-life", color: "text-green-bright", activeBg: "bg-green-bright/15", activeBorder: "border-green-bright/40" }, { id: "lava-lamp", color: "text-orange-bright", activeBg: "bg-orange-bright/15", activeBorder: "border-orange-bright/40" }, { id: "confetti", color: "text-yellow-bright", activeBg: "bg-yellow-bright/15", activeBorder: "border-yellow-bright/40" }, { id: "asciiquarium", color: "text-aqua-bright", activeBg: "bg-aqua-bright/15", activeBorder: "border-aqua-bright/40" }, { id: "pipes", color: "text-blue-bright", activeBg: "bg-blue-bright/15", activeBorder: "border-blue-bright/40" }, ]; // Cycle through accent colors for variant buttons const variantColors = [ { color: "text-yellow-bright", activeBg: "bg-yellow-bright/15", activeBorder: "border-yellow-bright/40" }, { color: "text-orange-bright", activeBg: "bg-orange-bright/15", activeBorder: "border-orange-bright/40" }, { color: "text-purple-bright", activeBg: "bg-purple-bright/15", activeBorder: "border-purple-bright/40" }, { color: "text-blue-bright", activeBg: "bg-blue-bright/15", activeBorder: "border-blue-bright/40" }, { color: "text-green-bright", activeBg: "bg-green-bright/15", activeBorder: "border-green-bright/40" }, { color: "text-red-bright", activeBg: "bg-red-bright/15", activeBorder: "border-red-bright/40" }, { color: "text-aqua-bright", activeBg: "bg-aqua-bright/15", activeBorder: "border-aqua-bright/40" }, ]; export function SettingsSheet({ open, onClose }: { open: boolean; onClose: () => void }) { const [currentTheme, setCurrentTheme] = useState(getStoredThemeId()); const [currentAnim, setCurrentAnim] = useState("shuffle"); useEffect(() => { setCurrentAnim(localStorage.getItem("animation") || "shuffle"); }, [open]); const handleTheme = (id: string) => { applyTheme(id); setCurrentTheme(id); }; const handleAnim = (id: string) => { localStorage.setItem("animation", id); document.documentElement.dataset.animation = id; document.dispatchEvent(new CustomEvent("animation-changed", { detail: { id } })); setCurrentAnim(id); onClose(); }; const currentFamily = THEMES[currentTheme]?.family ?? FAMILIES[0].id; return ( <> {/* Backdrop */}
{/* Sheet */}
Settings
{/* Theme */}
Theme
{/* Family selector */}
{FAMILIES.map((family) => ( ))}
{/* Variant selector for current family */}
{FAMILIES.find((f) => f.id === currentFamily)?.themes.map((theme, i) => { const style = variantColors[i % variantColors.length]; return ( ); })}
{/* Animation */}
Animation
{animOptions.map((opt) => ( ))}
{/* Links */}
Links
{footerLinks.map((link) => ( {link.label} ))}
); }