"use client"; import { useState, useEffect } from 'react' import { useTheme } from 'next-themes' const themes = ['system', 'light', 'dark'] as const const ThemeSwitch = () => { const [mounted, setMounted] = useState(false) const { theme, setTheme } = useTheme() useEffect(() => { setMounted(true) }, []) if (!mounted) return null const next = () => { const i = themes.indexOf(theme as (typeof themes)[number]) setTheme(themes[(i + 1) % themes.length]) } return ( ) } export default ThemeSwitch