'use client' import { useEffect, useState } from 'react' import * as Select from '@radix-ui/react-select' import { useTheme } from 'next-themes' import Icon from '../Icon' import { Item } from './Item' import styles from './index.module.css' export function getIconName(theme: string) { return theme === 'light' ? 'Sun' : theme === 'dark' ? 'Moon' : 'Contrast' } export default function ThemeSwitch() { const { theme, themes, resolvedTheme, setTheme } = useTheme() const iconName = getIconName(resolvedTheme || '') // hydration errors workaround const [mounted, setMounted] = useState(false) useEffect(() => setMounted(true), []) return ( ) }