blob: c65014536b345b944db36f30d5771d623cd2e06a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
import { useContext } from 'react';
import { AllowedLanguages, LanguageContext } from '../Locales/Context';
import { GetLocalizedString } from '../Locales/Locales';
import './Elements.css';
import SidebarListElement from './SidebarElement';
type SidebarProps = {
setLang: (newLang: AllowedLanguages) => void;
};
function Sidebar({setLang}: SidebarProps) {
var lang = useContext(LanguageContext);
return (
<nav className='Sidebar'>
<div className='SidebarContents'>
<h1> {GetLocalizedString("contents", lang)} </h1>
<ul className='ContentsList'>
<SidebarListElement Href='/' Text='Home' />
<SidebarListElement Href='/classes' Text='Classes' />
<SidebarListElement Href='/weapons' Text='Weapons' />
</ul>
<button onClick={() => {
setLang("ru");
window.location.reload();
}}> ru </button>
<button onClick={() => {
setLang("en");
window.location.reload();
}}> en </button>
</div>
</nav>
);
}
export default Sidebar;
|