import React, { Fragment, useState } from "react"; import { Trans, useTranslation } from "react-i18next"; import { Button } from "./Button/Button"; import { Menu, Transition } from "@headlessui/react"; import classNames from "classnames"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faLanguage } from "@fortawesome/free-solid-svg-icons"; type Props = React.ComponentPropsWithoutRef<"div">; const LocalizationButton = (props: Props) => { const { t, i18n } = useTranslation(); const changeLanguage = (lng: string) => { i18n.changeLanguage(lng); setLanguage(lng); }; const [language, setLanguage] = useState("en"); return (
{/* {language} */}
{({ active }) => ( { changeLanguage("en"); }} className={classNames( active ? "bg-gray-100 text-gray-900" : "text-gray-700", "block px-4 py-2 text-sm" )} > En )} {({ active }) => ( { changeLanguage("ru"); }} className={classNames( active ? "bg-gray-100 text-gray-900" : "text-gray-700", "block px-4 py-2 text-sm" )} > Ru )}
); }; export default LocalizationButton;