Navigation update

master
Tudor Stanciu 2020-05-14 22:48:30 +03:00
parent 550a602a80
commit 933ba890e5
4 changed files with 34 additions and 18 deletions

View File

@ -16,6 +16,7 @@
"Home": "Home",
"Sessions": "Sessions",
"ReleaseNotes": "Release notes",
"Log": "Log",
"About": "About"
},
"General": {

View File

@ -7,6 +7,7 @@
"Home": "Acasă",
"Sessions": "Sesiuni",
"ReleaseNotes": "Note lansare",
"Log": "Jurnal",
"About": "Despre"
},
"General": {

View File

@ -0,0 +1,26 @@
import React from "react";
import { NavLink } from "react-router-dom";
import PropTypes from "prop-types";
const MenuLink = ({ to, label, exact, last }) => {
const activeStyle = { color: "#F15B2A" };
const style = { color: "#fff" };
return (
<>
<NavLink to={to} activeStyle={activeStyle} style={style} exact={exact}>
{label}
</NavLink>
{!last && " | "}
</>
);
};
MenuLink.propTypes = {
to: PropTypes.string.isRequired,
label: PropTypes.string.isRequired,
exact: PropTypes.bool,
last: PropTypes.bool
};
export default MenuLink;

View File

@ -1,29 +1,17 @@
import React from "react";
import { NavLink } from "react-router-dom";
import { useTranslation } from "react-i18next";
import MenuLink from "./MenuLink";
const Navigation = () => {
const { t } = useTranslation();
const activeStyle = { color: "#F15B2A" };
const style = { color: "#fff" };
return (
<>
<NavLink to="/" activeStyle={activeStyle} style={style} exact>
{t("Menu.Home")}
</NavLink>
{" | "}
<NavLink to="/sessions" activeStyle={activeStyle} style={style}>
{t("Menu.Sessions")}
</NavLink>
{" | "}
<NavLink to="/release-notes" activeStyle={activeStyle} style={style}>
{t("Menu.ReleaseNotes")}
</NavLink>
{" | "}
<NavLink to="/about" activeStyle={activeStyle} style={style}>
{t("Menu.About")}
</NavLink>
<MenuLink to="/" label={t("Menu.Home")} exact />
<MenuLink to="/sessions" label={t("Menu.Sessions")} />
<MenuLink to="/release-notes" label={t("Menu.ReleaseNotes")} />
<MenuLink to="/log" label={t("Menu.Log")} />
<MenuLink to="/about" label={t("Menu.About")} last />
</>
);
};