import { useTheme } from "../core/hooks/useTheme.ts";
import { cn } from "../core/utils/cn.ts";
import { Monitor, Moon, Sun } from "lucide-react";
type ThemePreference = "light" | "dark" | "system";
export default function ThemeSwitcher({
className = "",
}: {
className?: string;
}) {
const { theme, preference, setPreference } = useTheme();
const themeIcons = {
light: ,
dark: ,
system: ,
};
const toggleTheme = () => {
const preferences: ThemePreference[] = ["light", "dark", "system"];
const currentIndex = preferences.indexOf(preference);
const nextPreference = preferences[(currentIndex + 1) % preferences.length];
setPreference(nextPreference);
};
const [firstCharOfPreference = "", ...restOfPreference] = preference;
return (
);
}