2019-10-18 08:16:26 +00:00
|
|
|
import React from "react";
|
|
|
|
|
import styled from "styled-components";
|
2019-10-29 12:02:58 +00:00
|
|
|
import { NavLink } from "react-router-dom";
|
2019-10-18 08:16:26 +00:00
|
|
|
|
|
|
|
|
type MenuBarItemProps = {
|
|
|
|
|
icon: Function;
|
|
|
|
|
path: string;
|
|
|
|
|
title: string;
|
2019-10-29 12:02:58 +00:00
|
|
|
exact: boolean;
|
2019-10-18 08:16:26 +00:00
|
|
|
};
|
|
|
|
|
|
2019-10-29 12:02:58 +00:00
|
|
|
type Props = MenuBarItemProps;
|
2019-10-18 08:16:26 +00:00
|
|
|
|
2019-10-29 12:02:58 +00:00
|
|
|
const IconContainer = styled.div`
|
2019-10-18 08:16:26 +00:00
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
padding: 5px;
|
2019-11-13 11:34:11 +00:00
|
|
|
margin-bottom: 5px;
|
2019-10-29 12:02:58 +00:00
|
|
|
background-color: ${props => props.theme.colors.menuButtonBGInactive};
|
2019-10-18 08:16:26 +00:00
|
|
|
border-radius: ${props => props.theme.radii[1]}px;
|
|
|
|
|
height: 32px;
|
|
|
|
|
width: 32px;
|
|
|
|
|
svg path {
|
2019-10-29 12:02:58 +00:00
|
|
|
fill: ${props => props.theme.colors.menuIconColorInactive};
|
2019-10-18 08:16:26 +00:00
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
|
2019-10-29 12:02:58 +00:00
|
|
|
const ItemContainer = styled.div`
|
|
|
|
|
a {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
2019-11-13 11:34:11 +00:00
|
|
|
height: 70px;
|
2019-10-29 12:02:58 +00:00
|
|
|
color: ${props => props.theme.colors.textOnDarkBG}
|
|
|
|
|
font-size: ${props => props.theme.fontSizes[1]}px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
background-color: ${props => props.theme.colors.navBG};
|
|
|
|
|
&:hover {
|
|
|
|
|
background-color: ${props => props.theme.colors.paneBG};
|
|
|
|
|
text-decoration: none;
|
|
|
|
|
}
|
2019-11-13 11:34:11 +00:00
|
|
|
color: ${props => props.theme.colors.menuButtonBGInactive};
|
2019-10-29 12:02:58 +00:00
|
|
|
&.active {
|
|
|
|
|
background-color: ${props => props.theme.colors.paneBG}
|
2019-11-13 11:34:11 +00:00
|
|
|
color: ${props => props.theme.colors.textOnDarkBG};
|
2019-10-29 12:02:58 +00:00
|
|
|
${IconContainer} {
|
|
|
|
|
background-color: ${props => props.theme.colors.primary};
|
|
|
|
|
svg path {
|
|
|
|
|
fill: ${props => props.theme.colors.textOnDarkBG};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
`;
|
2019-10-18 08:16:26 +00:00
|
|
|
|
2019-10-29 12:02:58 +00:00
|
|
|
class NavBarItem extends React.Component<Props> {
|
2019-10-18 08:16:26 +00:00
|
|
|
render(): React.ReactNode {
|
2019-10-29 12:02:58 +00:00
|
|
|
const { title, icon, path, exact } = this.props;
|
2019-10-18 08:16:26 +00:00
|
|
|
return (
|
2019-10-29 12:02:58 +00:00
|
|
|
<ItemContainer>
|
|
|
|
|
<NavLink exact={exact} to={path}>
|
|
|
|
|
<React.Fragment>
|
|
|
|
|
<IconContainer>{icon()}</IconContainer>
|
|
|
|
|
{title}
|
|
|
|
|
</React.Fragment>
|
|
|
|
|
</NavLink>
|
2019-10-18 08:16:26 +00:00
|
|
|
</ItemContainer>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-29 12:02:58 +00:00
|
|
|
export default NavBarItem;
|