translate event page contents

This commit is contained in:
Aarni Halinen
2021-04-01 17:33:38 +03:00
parent 39104f709b
commit 7ce9f38441
5 changed files with 93 additions and 55 deletions
+14 -8
View File
@@ -1,14 +1,20 @@
import React from "react";
import i18nNext, { useTranslation } from "../i18n";
const ChangeLanguageButton: React.FC = () => {
const { t } = useTranslation();
const { i18n } = i18nNext;
import styled from "styled-components";
import i18nNext from "../i18n";
import Icon, { IconType } from "./Icon";
const ChangeLanguageButton: React.FC = (props) => {
const { language, changeLanguage } = i18nNext.i18n;
return (
<button type="button" onClick={() => i18n.changeLanguage(i18n.language === "fi" ? "en" : "fi")}>{t("lngButton")}</button>
<button {...props} type="button" onClick={() => changeLanguage(language === "fi" ? "en" : "fi")}>
<Icon name={language === "fi" ? IconType.GBFlag : IconType.FinlandFlag} />
</button>
);
};
export default ChangeLanguageButton;
export default styled(ChangeLanguageButton)`
font-size: 4rem;
background: none;
border: none;
width: fit-content;
`;