"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 nextTheme = themes[(themes.indexOf(theme as (typeof themes)[number]) + 1) % themes.length] const next = () => setTheme(nextTheme) const label = `Theme: ${theme}. Click to switch to ${nextTheme}.` return ( ) } export default ThemeSwitch