'use client'

import useHasMounted from '@/hooks/useHasMounted'
import { Moon, Sun } from 'lucide-react'
import { useTheme } from 'next-themes'
import { Button } from './ui/button'

export function ThemeSwitcher() {
  const { setTheme, theme } = useTheme()
  const hasMounted = useHasMounted()

  return (
    <div>
      {hasMounted && theme === 'dark' ? (
        <Button onClick={() => setTheme('light')}>
          <Moon />
        </Button>
      ) : (
        <Button onClick={() => setTheme('dark')}>
          <Sun />
        </Button>
      )}
    </div>
  )
}
