2018-11-23 15:46:06 -08:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import styled from 'styled-components';
|
|
|
|
import { Link } from 'react-router-dom';
|
|
|
|
import { MENU_OPTIONS } from '../../constants/sidebar';
|
|
|
|
import { styles } from './styles';
|
|
|
|
|
|
|
|
// TODO: Not sure this is the best approach to styling
|
|
|
|
// in a StyledComponents-powered application
|
2018-11-26 18:52:47 -08:00
|
|
|
const Wrapper = styled.div`
|
|
|
|
${styles.wrapper}
|
|
|
|
`;
|
2018-11-23 15:46:06 -08:00
|
|
|
|
2018-11-26 18:52:47 -08:00
|
|
|
type MenuItem = { route: string, label: string };
|
|
|
|
|
|
|
|
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 => (
|
|
|
|
<Link key={item.route} to={item.route}>
|
2018-11-23 15:46:06 -08:00
|
|
|
{item.label}
|
|
|
|
</Link>
|
|
|
|
))}
|
|
|
|
</Wrapper>
|
|
|
|
);
|
2018-11-26 18:52:47 -08:00
|
|
|
|
|
|
|
SidebarComponent.defaultProps = {
|
|
|
|
options: MENU_OPTIONS,
|
|
|
|
};
|