From 2d6b15ea4fb9c92479aa3dd80a84e11d21dbc238 Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Mon, 27 Jan 2020 17:58:08 +0000 Subject: [PATCH] Sidebar toggle on mobile --- app/src/frontend/building/sidebar.css | 32 ++++++++++++++++++++------- app/src/frontend/building/sidebar.tsx | 30 ++++++++++++++++++++----- app/src/frontend/components/icons.tsx | 8 ++++++- 3 files changed, 55 insertions(+), 15 deletions(-) diff --git a/app/src/frontend/building/sidebar.css b/app/src/frontend/building/sidebar.css index 6788d572..b7857c22 100644 --- a/app/src/frontend/building/sidebar.css +++ b/app/src/frontend/building/sidebar.css @@ -3,25 +3,41 @@ */ .info-container { position: absolute; - top: 85px; + top: 75px; left: 0; bottom: 0; - overflow-y: auto; width: 95%; - padding: 0 0 2em; - background: #fff; - z-index: 1000; + width: calc(100% - 40px); + z-index: 1001; transition: transform 0.3s; + transform: translateX(0); +} +.info-container.offscreen { transform: translateX(-100%); } -.info-container.onscreen { - transform: translateX(0); +.info-container-collapse { + position: absolute; + right: -32px; + top: 2rem; + padding: 2.5rem 0rem; + border-radius: 0 .25rem .25rem 0; } @media (min-width: 768px){ .info-container { width: 480px; /* to match .main-header menu width */ - transform: translateX(0); } + .info-container.offscreen { + transform: translateX(0); + } + .info-container-collapse { + display: none; + } +} +.info-container-inner { + overflow-y: auto; + height: 100%; + padding: 0 0 2em; + background: #fff; } /** diff --git a/app/src/frontend/building/sidebar.tsx b/app/src/frontend/building/sidebar.tsx index 21a4ce84..e7a94c3e 100644 --- a/app/src/frontend/building/sidebar.tsx +++ b/app/src/frontend/building/sidebar.tsx @@ -1,11 +1,29 @@ -import React from 'react'; +import React, { useState, Fragment } from 'react'; import './sidebar.css'; +import { BackIcon, ForwardIcon } from '../components/icons'; -const Sidebar: React.FC<{}> = (props) => ( - -); +const Sidebar: React.FC<{}> = (props) => { + const [collapsed, setCollapsed] = useState(true); + + return ( + + + + ); +} export default Sidebar; diff --git a/app/src/frontend/components/icons.tsx b/app/src/frontend/components/icons.tsx index 8f49b932..7d0db4c1 100644 --- a/app/src/frontend/components/icons.tsx +++ b/app/src/frontend/components/icons.tsx @@ -2,7 +2,7 @@ * Mini-library of icons */ import { library } from '@fortawesome/fontawesome-svg-core'; -import { faAngleLeft, faCaretDown, faCaretRight, faCaretUp, faCheck, faCheckDouble, +import { faAngleLeft, faAngleRight, faCaretDown, faCaretRight, faCaretUp, faCheck, faCheckDouble, faEye, faInfoCircle, faPaintBrush, faQuestionCircle, faSearch, faTimes } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import React from 'react'; @@ -15,6 +15,7 @@ library.add( faCheck, faCheckDouble, faAngleLeft, + faAngleRight, faCaretDown, faCaretUp, faCaretRight, @@ -54,6 +55,10 @@ const BackIcon = () => ( ); +const ForwardIcon = () => ( + +); + const DownIcon = () => ( ); @@ -79,6 +84,7 @@ export { SaveIcon, SaveDoneIcon, BackIcon, + ForwardIcon, DownIcon, UpIcon, RightIcon,