import { useTheme } from 'next-themes' import { useState } from 'react' import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuTrigger, IconMoon, IconSun, Theme, themes, } from 'ui' interface ThemeToggleProps { forceDark?: boolean } export const ThemeToggle = ({ forceDark = false }: ThemeToggleProps) => { const { theme, setTheme } = useTheme() const [open, setOpen] = useState(false) // Conditionally force the theme to 'dark' when disabled is true const currentTheme = forceDark ? 'dark' : theme return ( setOpen(!open)} modal={false}> { setTheme(value) }} > {themes .filter((x) => x.value === 'dark' || x.value === 'light' || x.value === 'system') .map((theme: Theme) => ( {theme.name} ))} ) }