import { IconMoon, IconSun } from "@/components/ui/icons"; import { cn } from "@/lib/cn"; import { usePreferences } from "@/stores/preferences-context"; type ThemeModeControlProps = { variant: "toggle" | "compact" | "segmented" | "cards"; }; /** Shared theme control with layouts suited to each navigation surface. */ export function ThemeModeControl(props: ThemeModeControlProps) { const prefs = usePreferences(); const isDark = () => prefs.theme() === "dark"; const selectTheme = (theme: "light" | "dark") => prefs.setTheme(theme); const lightLabel = () => prefs.t("theme.light"); const darkLabel = () => prefs.t("theme.dark"); if (props.variant === "toggle") { return ( ); } if (props.variant === "compact") { // Icon-only, so each button carries its name; a thumb-sized target on // touch screens. return (
); } if (props.variant === "segmented") { return (
); } return (
); }