feat: Collapsible sidebar (#1721)

* wip

* styling, add keyboard shortcut

* tweak styling
This commit is contained in:
Tom Moor
2020-12-17 22:26:04 -08:00
committed by GitHub
parent 051ecab0fc
commit 40ca73e684
7 changed files with 126 additions and 6 deletions

View File

@@ -65,6 +65,11 @@ class Layout extends React.Component<Props> {
window.document.body.style.background = props.theme.background;
}
@keydown("meta+.")
handleToggleSidebar() {
this.props.ui.toggleCollapsedSidebar();
}
@keydown("shift+/")
handleOpenKeyboardShortcuts() {
if (this.props.ui.editMode) return;
@@ -119,7 +124,11 @@ class Layout extends React.Component<Props> {
</Switch>
)}
<Content auto justify="center" editMode={ui.editMode}>
<Content
auto
justify="center"
sidebarCollapsed={ui.editMode || ui.sidebarCollapsed}
>
{this.props.children}
</Content>
@@ -159,7 +168,10 @@ const Content = styled(Flex)`
}
${breakpoint("tablet")`
margin-left: ${(props) => (props.editMode ? 0 : props.theme.sidebarWidth)};
margin-left: ${(props) =>
props.sidebarCollapsed
? props.theme.sidebarCollapsedWidth
: props.theme.sidebarWidth};
`};
`;