import { Icon, Button, PopupTrigger, Popup, Text } from 'react-basics'; import classNames from 'classnames'; import { languages } from 'lib/lang'; import useLocale from 'hooks/useLocale'; import Icons from 'components/icons'; import styles from './LanguageButton.module.css'; export function LanguageButton() { const { locale, saveLocale, dir } = useLocale(); const items = Object.keys(languages).map(key => ({ ...languages[key], value: key })); function handleSelect(value, close) { saveLocale(value); close(); } return ( {close => { return (
{items.map(({ value, label }) => { return (
{label} {value === locale && ( )}
); })}
); }}
); } export default LanguageButton;