добавлено визуальное переключение языка

This commit is contained in:
DmitriyB
2022-07-26 16:59:39 +05:00
parent f3db4cd870
commit 2cb028ae16
2 changed files with 14 additions and 6 deletions
+5 -3
View File
@@ -40,20 +40,22 @@
font-weight: 400;
font-size: 18px;
line-height: 22px;
width: 90px;
/* width: 90px; */
display: flex;
justify-content: space-between;
gap: 8px;
}
.main-part-header-lang {
.main-part-header-lang-button {
display: flex;
justify-content: center;
align-items: center;
border-radius: 4px;
padding: 2px 8px;
cursor: pointer;
}
.main-part-header-lang.ru {
.main-part-header-lang-button.active {
background-color: #CE56C2;
}
+9 -3
View File
@@ -1,13 +1,19 @@
import React from "react";
import React, { useState } from "react";
import whiteLogo from './logoWhiteIcon.svg';
export const MainPartHeader:React.FC = React.memo(() => {
const [activeButton, setActiveButton] = useState<string>('ru');
function onClickChangeLang(lang: string) {
setActiveButton(lang);
}
return <div className="main-part-header">
<img className="main-part-header-logo" alt="logo" src={whiteLogo} />
<div className="main-part-header-lang">
<span className="main-part-header-lang en">EN</span>
<span className={`main-part-header-lang-button ${activeButton === 'en' ? 'active' : null}`} onClick={() => onClickChangeLang('en')}>EN</span>
<span className="main-part-header-lang-slash">/</span>
<span className="main-part-header-lang ru">RU</span>
<span className={`main-part-header-lang-button ${activeButton === 'ru' ? 'active' : null}`} onClick={() => onClickChangeLang('ru')}>RU</span>
</div>
</div>
})