'use client' import { Fragment, useEffect, useState } from 'react' import { useTheme } from 'next-themes' import { Menu, RadioGroup, Transition } from '@headlessui/react' const Sun = () => ( ) const Moon = () => ( ) const Monitor = () => ( ) const Blank = () => const ThemeSwitch = () => { const [mounted, setMounted] = useState(false) const { theme, setTheme, resolvedTheme } = useTheme() // When mounted on client, now we can show the UI useEffect(() => setMounted(true), []) return (
{mounted ? resolvedTheme === 'dark' ? : : }
{({ active }) => ( )} {({ active }) => ( )} {({ active }) => ( )}
) } export default ThemeSwitch