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

37 lines
945 B
TypeScript
Raw Normal View History

2018-09-11 15:59:37 -04:00
import React from 'react';
2018-10-01 12:20:25 -04:00
import { Link } from 'react-router-dom';
2019-05-27 13:26:29 -04:00
import PropTypes from 'prop-types';
2018-09-11 15:59:37 -04:00
import './sidebar.css';
import { BackIcon } from '../components/icons';
2018-09-11 15:59:37 -04:00
const Sidebar = (props) => (
2019-08-14 06:37:09 -04:00
<div id="sidebar" className="info-container">
{
props.title?
<header className="sidebar-header">
{
props.back?
<Link className="icon-button back" to={props.back}>
<BackIcon />
</Link>
: null
}
<h2 className="h2">{props.title}</h2>
</header>
: null
}
{
props.children
}
2018-09-11 15:59:37 -04:00
</div>
);
2019-05-27 13:26:29 -04:00
Sidebar.propTypes = {
back: PropTypes.string,
title: PropTypes.string.isRequired,
children: PropTypes.node
}
2018-09-11 15:59:37 -04:00
export default Sidebar;