"use client" import * as React from "react" import { cn } from "cn" const THEME_OPTIONS = [ { label: "Taupe", value: "theme-taupe" }, { label: "Neutral", value: "theme-neutral" }, { label: "Stone", value: "theme-stone" }, { label: "Zinc", value: "theme-zinc" }, { label: "Mauve", value: "theme-mauve" }, { label: "Olive", value: "theme-olive" }, { label: "Mist", value: "theme-mist" }, ] as const const DEFAULT_THEME = "theme-taupe" function applyThemeToPreviews(theme: string) { const previewElements = document.querySelectorAll(".preview") previewElements.forEach((element) => { THEME_OPTIONS.forEach((option) => { element.classList.remove(option.value) }) element.classList.add(theme) }) } export function ThemeSwitcher() { const [theme, setTheme] = React.useState(DEFAULT_THEME) React.useEffect(() => { applyThemeToPreviews(theme) }, [theme]) return (
{THEME_OPTIONS.map((option) => ( ))}
) }