11'use client' ;
22
33import { useTheme } from 'next-themes' ;
4+ import { useTranslations } from 'next-intl' ;
45import { Monitor , Sun , Moon } from 'lucide-react' ;
56import { motion } from 'framer-motion' ;
67import { useEffect , useState } from 'react' ;
78
89const themes = [
9- { value : 'system' , icon : Monitor , label : 'System theme ' } ,
10- { value : 'light' , icon : Sun , label : 'Light theme ' } ,
11- { value : 'dark' , icon : Moon , label : 'Dark theme ' } ,
10+ { value : 'system' , icon : Monitor , labelKey : 'themeSystem ' } ,
11+ { value : 'light' , icon : Sun , labelKey : 'themeLight ' } ,
12+ { value : 'dark' , icon : Moon , labelKey : 'themeDark ' } ,
1213] as const ;
1314
1415export function ThemeToggle ( ) {
1516 const { theme, setTheme } = useTheme ( ) ;
17+ const t = useTranslations ( 'aria' ) ;
1618 const [ mounted , setMounted ] = useState ( false ) ;
1719
1820 useEffect ( ( ) => {
@@ -36,11 +38,11 @@ export function ThemeToggle() {
3638
3739 return (
3840 < div className = "flex h-9 items-center gap-1 rounded-full bg-neutral-100 p-1 dark:border dark:border-neutral-800 dark:bg-neutral-950" >
39- { themes . map ( ( { value, icon : Icon , label } ) => (
41+ { themes . map ( ( { value, icon : Icon , labelKey } ) => (
4042 < button
4143 key = { value }
4244 onClick = { ( ) => setTheme ( value ) }
43- aria-label = { label }
45+ aria-label = { t ( labelKey ) }
4446 className = "theme-toggle-btn relative flex h-7 w-7 items-center justify-center rounded-full"
4547 >
4648 { theme === value && (
0 commit comments