import {useState} from 'react'; import MenuList from '@mui/material/MenuList'; import MenuItem from '@mui/material/MenuItem'; import Box from '@mui/material/Box'; import {useTheme} from '@mui/material/styles'; import {useTranslation} from 'next-i18next'; import withLanguagesSelection, { LanguageSelectionComponentProps, } from './withLanguagesSelection'; import {langLocales, langs} from '../../locales/constants'; const Languages = ({ language, onChangeLang, }: LanguageSelectionComponentProps) => { const theme = useTheme(); const {t} = useTranslation(); const [isSelecting, setSelecting] = useState(false); const handleClick = event => { setSelecting(!isSelecting); }; const onConfirm = (lang: (typeof langs)[number]) => { setSelecting(false); onChangeLang(lang); }; return ( {t('menu.language')} {langs.map(lang => ( onConfirm(lang)} > {langLocales[lang]} ))} ); }; export default withLanguagesSelection(Languages);