2020-08-06 18:59:22 +00:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { Link } from 'react-router';
|
|
|
|
import styled from 'styled-components';
|
2020-08-07 17:09:17 +00:00
|
|
|
import { remSize, prop, common } from '../../theme';
|
|
|
|
import Header from './Header';
|
|
|
|
import IconButton from './IconButton';
|
|
|
|
import { ExitIcon } from '../../common/icons';
|
2020-08-06 18:59:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
const SidebarWrapper = styled.div`
|
|
|
|
height: 100%;
|
|
|
|
width: ${remSize(180)};
|
|
|
|
|
|
|
|
position: absolute;
|
|
|
|
z-index: 2;
|
|
|
|
left: 0;
|
|
|
|
|
|
|
|
background: white;
|
|
|
|
box-shadow: 0 6px 6px 0 rgba(0,0,0,0.10);
|
|
|
|
`;
|
|
|
|
|
2020-08-07 17:09:17 +00:00
|
|
|
const Sidebar = ({ title, onPressClose, children }) => (
|
2020-08-06 18:59:22 +00:00
|
|
|
<SidebarWrapper>
|
|
|
|
{title &&
|
2020-08-06 19:24:47 +00:00
|
|
|
<Header slim title={title} fixed={false}>
|
2020-08-07 21:32:50 +00:00
|
|
|
<IconButton onClick={onPressClose} icon={ExitIcon} aria-label="Return to ide view" />
|
2020-08-06 18:59:22 +00:00
|
|
|
</Header>}
|
2020-08-07 17:09:17 +00:00
|
|
|
{children}
|
2020-08-06 18:59:22 +00:00
|
|
|
</SidebarWrapper>
|
|
|
|
);
|
|
|
|
|
|
|
|
Sidebar.propTypes = {
|
|
|
|
title: PropTypes.string,
|
2020-08-07 17:09:17 +00:00
|
|
|
onPressClose: PropTypes.func,
|
|
|
|
children: PropTypes.oneOfType([PropTypes.element, PropTypes.arrayOf(PropTypes.element)]),
|
2020-08-06 18:59:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Sidebar.defaultProps = {
|
|
|
|
title: null,
|
2020-08-07 17:09:17 +00:00
|
|
|
children: [],
|
|
|
|
onPressClose: () => {}
|
2020-08-06 18:59:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export default Sidebar;
|