'use client'; import { useTheme } from 'next-themes'; import { useTranslations } from 'next-intl'; import { useEffect, useState } from 'react'; export function ThemeToggle() { const { theme, setTheme } = useTheme(); const t = useTranslations('theme'); const [mounted, setMounted] = useState(false); useEffect(() => { setMounted(true); }, []); function cycleTheme() { if (theme === 'light') { setTheme('dark'); } else if (theme === 'dark') { setTheme('system'); } else { setTheme('light'); } } const label = mounted ? theme === 'light' ? t('light') : theme === 'dark' ? t('dark') : t('system') : ''; return ( ); }