colouring-montreal/app/src/frontend/building/sidebar.tsx

30 lines
843 B
TypeScript
Raw Normal View History

2020-01-27 12:58:08 -05:00
import React, { useState, Fragment } from 'react';
2018-09-11 15:59:37 -04:00
import './sidebar.css';
2020-01-27 12:58:08 -05:00
import { BackIcon, ForwardIcon } from '../components/icons';
2018-09-11 15:59:37 -04:00
2020-01-27 12:58:08 -05:00
const Sidebar: React.FC<{}> = (props) => {
const [collapsed, setCollapsed] = useState(true);
return (
<Fragment>
<div id="sidebar" className={"info-container " + (collapsed? "offscreen": "")}>
<button className="info-container-collapse btn btn-light"
onClick={() => setCollapsed(!collapsed)}
>
{
collapsed?
<ForwardIcon />
: <BackIcon />
}
</button>
<div className="info-container-inner">
{ props.children }
</div>
</div>
</Fragment>
);
}
2018-09-11 15:59:37 -04:00
export default Sidebar;