import { LanguageIcon } from '@heroicons/react/24/outline'; import * as DropdownMenu from '@radix-ui/react-dropdown-menu'; import classNames from 'classnames'; import { useTranslations } from 'next-intl'; import type { FC } from 'react'; import type { LocaleConfig } from '@/types'; import styles from './index.module.css'; type SimpleLocaleConfig = Pick; type LanguageDropDownProps = { onChange?: (newLocale: SimpleLocaleConfig) => void; currentLanguage: string; availableLanguages: Array; }; const LanguageDropdown: FC = ({ onChange = () => {}, currentLanguage, availableLanguages, }) => { const t = useTranslations(); const ariaLabel = t('components.common.languageDropdown.label'); return (
{availableLanguages.map(({ name, code }) => ( onChange({ name, code })} className={classNames(styles.dropDownItem, { [styles.currentDropDown]: code === currentLanguage, })} > {name} ))}
); }; export default LanguageDropdown;