'use client' import {useEffect, useState} from 'react' import {useTheme} from 'next-themes' import {SunIcon} from '@/components/icons/SunIcon' import {MoonIcon} from '@/components/icons/MoonIcon' export function ThemeButton() { const [mounted, setMounted] = useState(false) const {resolvedTheme, setTheme} = useTheme() let otherTheme = resolvedTheme === 'dark' ? 'light' : 'dark' useEffect(() => { const timeout = setTimeout(() => setMounted(true), 500) return () => clearTimeout(timeout) }, []) if (!mounted) return return ( ) } ThemeButton.Skeleton = function ThemeButtonSkeleton() { return (
) }