import { Button } from '@/components/ui/button' import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu' import { Laptop, Moon, Sun } from 'lucide-react' import * as React from 'react' export function ModeToggle() { const [theme, setThemeState] = React.useState< 'theme-light' | 'dark' | 'system' >('theme-light') React.useEffect(() => { const isDarkMode = document.documentElement.classList.contains('dark') setThemeState(isDarkMode ? 'dark' : 'theme-light') }, []) React.useEffect(() => { const isDark = theme === 'dark' || (theme === 'system' && window.matchMedia('(prefers-color-scheme: dark)').matches) document.documentElement.classList.add('disable-transitions') document.documentElement.classList[isDark ? 'add' : 'remove']('dark') window .getComputedStyle(document.documentElement) .getPropertyValue('opacity') requestAnimationFrame(() => { document.documentElement.classList.remove('disable-transitions') }) }, [theme]) return ( setThemeState('theme-light')}> Light setThemeState('dark')}> Dark setThemeState('system')}> System ) }