zepio/app/components/sidebar.js

48 lines
965 B
JavaScript
Raw Normal View History

// @flow
import React from 'react';
import styled from 'styled-components';
import { Link } from 'react-router-dom';
import { MENU_OPTIONS } from '../constants/sidebar';
2018-11-26 18:52:47 -08:00
const Wrapper = styled.div`
display: flex;
flex-direction: column;
width: 200px;
height: 100vh;
2018-12-04 20:26:03 -08:00
font-family: ${props => props.theme.fontFamily}
background-color: ${props => props.theme.colors.sidebarBg};
padding: 20px;
`;
const StyledLink = styled(Link)`
2018-12-04 20:26:03 -08:00
color: ${props => props.theme.colors.sidebarItem};
font-size: 16px;
text-decoration: none;
font-weight: 700;
padding: 5px 0;
2018-11-26 18:52:47 -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) => (
<Wrapper>
2018-11-26 18:52:47 -08:00
{(options || []).map(item => (
<StyledLink key={item.route} to={item.route}>
{item.label}
</StyledLink>
))}
</Wrapper>
);
2018-11-26 18:52:47 -08:00
SidebarComponent.defaultProps = {
options: MENU_OPTIONS,
};