This commit is contained in:
cha0s 2020-06-27 07:51:27 -05:00
parent 0b3fd67813
commit c4753aa5d6
6 changed files with 58 additions and 13 deletions

View File

@ -1,6 +1,8 @@
import './app.scss'; import './app.scss';
import {hot} from 'react-hot-loader'; import {hot} from 'react-hot-loader';
import classnames from 'classnames';
import React, {useState} from 'react'; import React, {useState} from 'react';
import TypeRenderersContext from './context/typeRenderers'; import TypeRenderersContext from './context/typeRenderers';
@ -16,17 +18,36 @@ const typeRenderMap = () => Object.values(allTypeRenderers()).reduce((r, M) => {
const App = () => { const App = () => {
const [typeRenderers] = useState(typeRenderMap()); const [typeRenderers] = useState(typeRenderMap());
const [activeSidebar, setActiveSidebar] = useState(0);
const [isSidebarExpanded, setIsSidebarExpanded] = useState(true);
return ( return (
<div className="app"> <div className="app">
<TypeRenderersContext.Provider value={typeRenderers}> <TypeRenderersContext.Provider value={typeRenderers}>
<div className="panes horizontal"> <div className="panes horizontal">
<div className="sidebar-icons-wrapper pane"> <div
<SidebarIcons /> className="sidebar-icons-wrapper pane"
>
<SidebarIcons
active={[activeSidebar, setActiveSidebar]}
isExpanded={[isSidebarExpanded, setIsSidebarExpanded]}
/>
</div> </div>
<div className="sidebar-wrapper pane"> <div
className={classnames(
'sidebar-wrapper',
'pane',
{expanded: isSidebarExpanded},
)}
>
<Sidebar /> <Sidebar />
</div> </div>
<div className="resources-wrapper pane"> <div
className={classnames(
'resources-wrapper',
'pane',
{'sidebar-expanded': isSidebarExpanded},
)}
>
<Resources /> <Resources />
</div> </div>
</div> </div>

View File

@ -21,9 +21,16 @@
} }
.sidebar-wrapper { .sidebar-wrapper {
width: 24em; max-width: calc(100% - 4em);
width: 0;
&.expanded {
width: 24em;
}
} }
.resources-wrapper { .resources-wrapper {
width: calc(100% - 28em); width: calc(100% - 4em);
&.sidebar-expanded {
width: calc(100% - 28em);
}
} }

View File

@ -48,6 +48,7 @@ table {
html { html {
background-color: #212121; background-color: #212121;
color: #FFFFFF; color: #FFFFFF;
--active-color: rgb(0, 180, 204);
} }
body { body {
scrollbar-width: thin; scrollbar-width: thin;
@ -140,7 +141,7 @@ select {
*:focus { *:focus {
position: relative; position: relative;
box-shadow: 0 0 2px 0 #d68030ff; box-shadow: 0 0 2px 0 var(--active-color);
outline: none; outline: none;
z-index: 1; z-index: 1;
} }
@ -219,7 +220,7 @@ select {
.react-tabs__tab-panel { .react-tabs__tab-panel {
display: none; display: none;
overflow-y: auto; overflow-y: auto;
height: calc(100% - 3em); height: calc(100% - 2.7em);
width: 100%; width: 100%;
} }

View File

@ -1,4 +1,3 @@
%trait { %trait {
font-size: 1.5em; font-size: 1.5em;
padding: 1em;
} }

View File

@ -7,17 +7,25 @@ const decorate = compose(
contempo(require('./sidebar-icons.raw.scss')), contempo(require('./sidebar-icons.raw.scss')),
); );
const SidebarIcons = () => { const SidebarIcons = (props) => {
const [opened, setOpened] = useState(false); const {
active: [activeSidebar, setActiveSidebar],
isExpanded: [isSidebarExpanded, setIsSidebarExpanded],
} = props;
return ( return (
<div className="sidebar-icons"> <div className="sidebar-icons">
<button <button
className={classnames( className={classnames(
'icon', 'icon',
'files', 'files',
{opened}, {active: 0 === activeSidebar},
{expanded: 0 === activeSidebar && isSidebarExpanded},
)} )}
onClick={() => setOpened(!opened)} onClick={() => {
if (0 === activeSidebar) {
setIsSidebarExpanded(!isSidebarExpanded);
}
}}
type="button" type="button"
> >

View File

@ -12,6 +12,15 @@
justify-content: center; justify-content: center;
height: 4em; height: 4em;
width: 4em; width: 4em;
&.active {
border-left: 3px solid #ffffff;
svg path {
fill: #ffffff;
}
}
&.expanded {
border-left: 3px solid var(--active-color);
}
svg { svg {
height: 100%; height: 100%;
width: 100%; width: 100%;