import * as React from "react"; import { useState } from "react"; import { Button } from "../../atoms/button"; import { Submenu } from "../submenu"; import { DropdownMenu, DropdownMenuWrapper } from "../dropdown"; import "./index.scss"; import { switchTheme } from "../../../utils"; import { Theme } from "../../../types/theme"; import { useUIStatus } from "../../../ui-context"; import { useGleanClick } from "../../../telemetry/glean-context"; import { THEME_SWITCHER } from "../../../telemetry/constants"; type ThemeButton = { id: Theme; label: string; }; export const ThemeSwitcher = () => { const menuId = "themes-menu"; const [isOpen, setIsOpen] = useState(false); const gleanClick = useGleanClick(); const { setColorScheme } = useUIStatus(); const [activeTheme, setActiveTheme] = React.useState("os-default"); function ThemeButton({ id, label }: ThemeButton) { return ( ); } const menu = { label: "Themes", id: menuId, items: [ { component: () => }, { component: () => }, { component: () => }, ], }; React.useEffect(() => { let theme: Theme | null = null; try { theme = localStorage.getItem("theme") as Theme; } catch (e) { console.warn("Unable to read theme from localStorage", e); } switchTheme(theme ?? "os-default", setActiveTheme); }, []); return ( ); };