2018-11-23 15:46:06 -08:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import styled from 'styled-components';
|
|
|
|
import { Link } from 'react-router-dom';
|
2018-11-28 14:00:25 -08:00
|
|
|
import { MENU_OPTIONS } from '../constants/sidebar';
|
2018-11-23 15:46:06 -08:00
|
|
|
|
2018-11-26 18:52:47 -08:00
|
|
|
const Wrapper = styled.div`
|
2018-11-28 14:00:25 -08:00
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
width: 200px;
|
|
|
|
position: absolute;
|
|
|
|
left: 0;
|
|
|
|
top: 0;
|
|
|
|
height: 100vh;
|
2018-11-28 17:54:08 -08:00
|
|
|
background-color: ${props => props.theme.colors.secondary};
|
2018-11-28 14:00:25 -08:00
|
|
|
`;
|
|
|
|
|
|
|
|
const StyledLink = styled(Link)`
|
|
|
|
color: ${props => props.theme.colors.primary};
|
2018-11-26 18:52:47 -08:00
|
|
|
`;
|
2018-11-23 15:46:06 -08:00
|
|
|
|
2018-11-28 20:14:44 -08:00
|
|
|
type MenuItem = {
|
|
|
|
route: string,
|
|
|
|
label: string,
|
|
|
|
};
|
2018-11-26 18:52:47 -08:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
options?: MenuItem[],
|
|
|
|
};
|
|
|
|
|
|
|
|
export const SidebarComponent = ({ options }: Props) => (
|
2018-11-23 15:46:06 -08:00
|
|
|
<Wrapper>
|
2018-11-26 18:52:47 -08:00
|
|
|
{(options || []).map(item => (
|
2018-11-28 14:00:25 -08:00
|
|
|
<StyledLink key={item.route} to={item.route}>
|
2018-11-23 15:46:06 -08:00
|
|
|
{item.label}
|
2018-11-28 14:00:25 -08:00
|
|
|
</StyledLink>
|
2018-11-23 15:46:06 -08:00
|
|
|
))}
|
|
|
|
</Wrapper>
|
|
|
|
);
|
2018-11-26 18:52:47 -08:00
|
|
|
|
|
|
|
SidebarComponent.defaultProps = {
|
|
|
|
options: MENU_OPTIONS,
|
|
|
|
};
|