import { ToggleGroup, Tooltip } from "@digdir/designsystemet-react"; import { MonitorIcon, MoonIcon, SunIcon } from "@navikt/aksel-icons"; import { getLocalizedString } from "@olenbetong/appframe-core"; import { type ColorSchemePreference, useColorSchemePreference } from "../../colorScheme.js"; const OPTIONS: Array<{ value: ColorSchemePreference; label: string; Icon: typeof MonitorIcon }> = [ { value: "auto", label: "Follow system setting", Icon: MonitorIcon }, { value: "light", label: "Light mode", Icon: SunIcon }, { value: "dark", label: "Dark mode", Icon: MoonIcon }, ]; /** Icon-only color scheme toggle, shown at the bottom of the app menu rail. */ export function AppMenuColorScheme() { let [preference, setPreference] = useColorSchemePreference(); return (
setPreference(value as ColorSchemePreference)} > {OPTIONS.map(({ value, label, Icon }) => { let localizedLabel = getLocalizedString(label); return ( {/* The radio takes its accessible name from the label's text content. */} {localizedLabel} ); })}
); }