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