UX: allow sidebar to appear inline down to 768px (#20271)

* UX: allow sidebar to appear inline down to 768px

* test fix

* fix typos
This commit is contained in:
Kris 2023-02-13 17:51:42 -05:00 committed by GitHub
parent 9cb0ebcd58
commit 1c64b2dd95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 29 additions and 14 deletions

View File

@ -10,7 +10,7 @@ const NarrowDesktop = {
}, },
isNarrowDesktopView(width) { isNarrowDesktopView(width) {
return width < 1000; return width < 768;
}, },
}; };

View File

@ -18,14 +18,14 @@ acceptance("Sidebar - Narrow Desktop", function (needs) {
await click(".header-sidebar-toggle .btn"); await click(".header-sidebar-toggle .btn");
assert.ok(!exists("#d-sidebar"), "widge sidebar is collapsed"); assert.ok(!exists("#d-sidebar"), "wide sidebar is collapsed");
await click(".header-sidebar-toggle .btn"); await click(".header-sidebar-toggle .btn");
assert.ok(exists("#d-sidebar"), "wide sidebar is displayed"); assert.ok(exists("#d-sidebar"), "wide sidebar is displayed");
const bodyElement = document.querySelector("body"); const bodyElement = document.querySelector("body");
bodyElement.style.width = "990px"; bodyElement.style.width = "767px";
await waitUntil( await waitUntil(
() => document.querySelector(".btn-sidebar-toggle.narrow-desktop"), () => document.querySelector(".btn-sidebar-toggle.narrow-desktop"),
@ -60,7 +60,7 @@ acceptance("Sidebar - Narrow Desktop", function (needs) {
await settled(); await settled();
const bodyElement = document.querySelector("body"); const bodyElement = document.querySelector("body");
bodyElement.style.width = "990px"; bodyElement.style.width = "767px";
await waitUntil( await waitUntil(
() => document.querySelector(".btn-sidebar-toggle.narrow-desktop"), () => document.querySelector(".btn-sidebar-toggle.narrow-desktop"),

View File

@ -1,5 +1,8 @@
:root { :root {
--d-sidebar-width: #{$d-sidebar-width}; --d-sidebar-width: #{$d-sidebar-width};
@include breakpoint(large) {
--d-sidebar-width: #{$d-sidebar-narrow-width};
}
--d-sidebar-animation-time: 0.25s; --d-sidebar-animation-time: 0.25s;
--d-sidebar-animation-ease: ease-in-out; --d-sidebar-animation-ease: ease-in-out;
--d-sidebar-row-height: 30px; --d-sidebar-row-height: 30px;

View File

@ -18,6 +18,7 @@ $topic-avatar-width: 45px;
$reply-area-max-width: 1475px !default; $reply-area-max-width: 1475px !default;
$d-sidebar-width: 16em !default; $d-sidebar-width: 16em !default;
$d-sidebar-narrow-width: 14em !default;
// Brand color variables // Brand color variables
// -------------------------------------------------- // --------------------------------------------------

View File

@ -205,6 +205,9 @@ body.has-sidebar-page {
#main-outlet-wrapper { #main-outlet-wrapper {
grid-template-columns: var(--d-sidebar-width) minmax(0, 1fr); grid-template-columns: var(--d-sidebar-width) minmax(0, 1fr);
gap: 0 2em; gap: 0 2em;
@include breakpoint(large) {
gap: 0 1em;
}
padding-left: 0; padding-left: 0;
} }
} }

View File

@ -202,10 +202,10 @@
} }
// reduce width for more title space // reduce width for more title space
.posts { .posts {
width: 50px; width: 3em;
} }
.posters { .posters {
width: 30px; width: 2em;
text-align: center; text-align: center;
} }
// show only the first poster // show only the first poster
@ -227,26 +227,34 @@
} }
} }
@include breakpoint(large, $sidebar: true) {
.topic-list {
.topic-list-item .topic-list-data:first-of-type {
padding: 0.8em 0.33em;
}
.topic-list-data {
padding: 0.33em;
}
}
}
@include breakpoint(medium) { @include breakpoint(medium) {
// slightly smaller font, tighten spacing on nav pills
.nav-pills { .nav-pills {
> li > a { > li > a {
font-size: var(--font-0); font-size: var(--font-0);
padding: 7px 10px; padding: 0.45em 0.67em;
} }
} }
.topic-list { .topic-list {
// tighter table header spacing
.topic-list-item .topic-list-data:first-of-type {
padding: 12px 5px;
}
// smaller table cell spacing
.topic-list-data { .topic-list-data {
padding: 10px;
font-size: var(--font-0); font-size: var(--font-0);
} }
} }
.topic-list-header {
font-size: var(--font-down-1);
}
} }
.container.list-container { .container.list-container {