UX: option to account for the sidebar in the breakpoint mixin (#17577)

* UX: account for sidebar in breakpoint mixin

* default to false
This commit is contained in:
Kris 2022-07-19 22:56:41 -04:00 committed by GitHub
parent 02ce9b8a62
commit a24bcceb19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 3 deletions

View File

@ -1,5 +1,5 @@
:root {
--d-sidebar-width: 16em;
--d-sidebar-width: #{$d-sidebar-width};
--d-sidebar-animation-time: 0.25s;
--d-sidebar-animation-ease: ease-in-out;
}

View File

@ -16,10 +16,22 @@ $breakpoints: (
extra-large: 1140px,
);
@mixin breakpoint($bp, $rule: max-width, $type: screen) {
@mixin breakpoint($bp, $rule: max-width, $type: screen, $sidebar: false) {
@media #{$type} and (#{$rule}: map-get($breakpoints, $bp)) {
@content;
}
// if you want to consider the sidebar in your breakpoint
// you can pass in $sidebar: true
// note that your breakpoint will need to be at the root level
@if $sidebar {
// when the sidebar is shown, we want to increase the breakpoints by the width of the sidebar
@media #{$type} and (#{$rule}: calc(#{map-get($breakpoints, $bp)} + #{$d-sidebar-width})) {
.has-sidebar-page {
@content;
}
}
}
}
// CSS3 properties

View File

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

View File

@ -196,7 +196,7 @@
/* Tablet (portrait) ----------- */
@include breakpoint(medium) {
@include breakpoint(medium, $sidebar: true) {
// slightly smaller font, tighten spacing on nav pills
.nav-pills {
> li > a {