Simplify sidebar container - no title

This commit is contained in:
Tom Russell 2019-08-14 13:41:13 +01:00
parent 1ab015e4df
commit 44bd5e67d1
4 changed files with 5 additions and 41 deletions

View File

@ -19,10 +19,10 @@ const BuildingEdit = (props) => {
if (!props.building_id || sections.length !== 1){
return (
<Sidebar title="Building Not Found" back={`/edit/categories.html`}>
<Sidebar>
<InfoBox msg="We can't find that one anywhere - try the map again?" />
<div className="buttons-container ml-3 mr-3">
<Link to={`/edit/categories.html`} className="btn btn-secondary">Back to maps</Link>
<Link to={`/edit/categories.html`} className="btn btn-secondary">Back to categories</Link>
</div>
</Sidebar>
);

View File

@ -16,7 +16,7 @@ const BuildingView = (props) => {
if (!props.building_id || sections.length !== 1){
return (
<Sidebar title="Building Not Found" back={`/view/categories.html`}>
<Sidebar>
<InfoBox msg="We can't find that one anywhere - try the map again?" />
<div className="buttons-container with-space">
<Link to="/view/categories.html" className="btn btn-secondary">Back to categories</Link>

View File

@ -51,23 +51,7 @@
}
/**
* Sidebar main header
*/
.sidebar-header h2 {
margin: 0.45rem 0 0.6rem;
display: inline-block;
}
.sidebar-header .icon-button {
margin-left: 0.25rem;
margin-top: 0.3rem;
}
.sidebar-header .icon-button:hover {
background-color: #eee;
}
/**
* Data list section headers
* Data section headers
*/
.section-header {
display: block;

View File

@ -1,35 +1,15 @@
import React from 'react';
import { Link } from 'react-router-dom';
import PropTypes from 'prop-types';
import './sidebar.css';
import { BackIcon } from '../components/icons';
const Sidebar = (props) => (
<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
}
{ props.children }
</div>
);
Sidebar.propTypes = {
back: PropTypes.string,
title: PropTypes.string.isRequired,
children: PropTypes.node
}