From cd529c25795053fbc10d2592b6b2af8327ddc518 Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Mon, 21 Nov 2022 08:14:06 -0500 Subject: [PATCH 1/3] Collapse sections of the sidebar --- assets/style.scss | 72 ++++++++++++++++++++++++++++++++--- layouts/partials/sidebar.html | 42 +++++++++++++++++++- 2 files changed, 107 insertions(+), 7 deletions(-) diff --git a/assets/style.scss b/assets/style.scss index 460744ac..66f53c97 100644 --- a/assets/style.scss +++ b/assets/style.scss @@ -125,6 +125,10 @@ body { margin-top: 12px; margin-bottom: 52px; + :root.js & { + margin-bottom: 42px; + } + img { height: 38px; } @@ -138,9 +142,52 @@ body { } } + .toggle-button { + -webkit-appearance: none; + appearance: none; + background: lighten($darkest, 4%); + border: none; + border-radius: 4px; + padding: 6px 12px 4px; + margin: 0; + font: inherit; + cursor: pointer; + color: inherit; + margin-bottom: 20px; + display: flex; + align-items: center; + font-weight: 500; + + strong { + font-size: 1.3em; + line-height: 0; + margin-right: 0.5em; + margin-bottom: 0.1em; + } + + &:hover, + &:focus { + background: lighten($darkest, 8%); + } + &:active { + background: lighten($darkest, 12%); + } + + :root:not(.js) & { + display: none; + } + } + & > ul > li { margin-bottom: 26px; + &.collapsed { + & > .sub-title::before { + transform: rotate(-90deg); + } + margin-bottom: 10px; + } + &:last-child { margin-bottom: 0; } @@ -151,6 +198,21 @@ body { padding: 10px; font-weight: 500; text-transform: uppercase; + + :root.js & { + -webkit-user-select: none; + user-select: none; + cursor: pointer; + + &::before { + content: ''; + display: inline-block; + width: 8px; + height: 8px; + margin-right: 10px; + background: url('data:image/svg+xml;utf8,') no-repeat; + } + } } & > ul a { @@ -161,11 +223,11 @@ body { padding: 10px; } - .sub-menu { - a.active { - color: $vibrant; - } + a.active { + color: $vibrant; + } + .sub-menu { &.collapsed { display: none; } @@ -840,4 +902,4 @@ main { align-content: center; margin-left: 0.25em; } -} \ No newline at end of file +} diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index f93a3515..b01fec31 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -4,8 +4,9 @@