Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix menu being empty on narrow layouts #6440

Merged
merged 1 commit into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/_sass/base/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
}

#page-content {
display: flex;
min-height: calc(100vh - $site-header-height);
min-width: 0;
width: 100%;
flex-direction: row;
justify-content: center;

&:not(.focused) {
display: flex;
flex-direction: row;
justify-content: center;
&.focused {
flex-direction: column;
}

body.obsolete & {
Expand Down
39 changes: 11 additions & 28 deletions src/_sass/components/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,49 +40,32 @@
align-items: center;
}
}
}
}

.brand {
display: flex;
width: 5.5rem;
overflow: hidden;
margin-left: 1.25rem;
align-items: center;
}
}

// TODO(parlough): Reverse and simplify these media queries.
@media(max-width: 960px) {
#mainnav {
ul {
li {
// TODO(parlough): Reverse and simplify these media queries.
@media(max-width: 960px) {
display: none;

&.searchfield {
display: block;
}
}
}
}
}

@media(max-width: 479px) {
#menu-toggle {
order: 2;
}

#mainnav {
ul {
li {
@media(max-width: 479px) {
&.searchfield {
display: none;
}
}
}
}
}

.brand {
display: flex;
width: 5.5rem;
overflow: hidden;
margin-left: 1.25rem;
align-items: center;
}
}

.site-header {
background-color: $site-color-white;
Expand Down
68 changes: 30 additions & 38 deletions src/_sass/components/_sidenav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,44 @@
@use '../base/mixins';

$sidenav-divider-color: #e7e8ed;
$sidenav-wide-layout: 1024px;

#sidenav {
margin: 0;
overflow-y: auto;
width: 16rem;
min-width: 16rem;
height: calc(100vh - $site-header-height);
padding: 0.75rem 0.75rem 2.25rem;
position: sticky;
top: 0;
scrollbar-width: thin;

border-right: 0.1rem solid $sidenav-divider-color;
display: none;
width: 100%;
background: #fff;
z-index: 100;

// TODO(parlough): Reverse and simplify these media queries.
@media (max-width: 1024px) {
width: 100%;
background: #fff;
z-index: 100;
@at-root body.open_menu {
#sidenav {
display: block;
}

.site-header__search {
display: flex;
// Only hide page content if menu is open and in narrow layout.
#page-content {
display: none;
}
}

@media (max-width: 1024px) {
@media (min-width: $sidenav-wide-layout) {
display: block;
width: 16rem;

@at-root body.open_menu {
&:before {
content: '';
display: block;
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
height: 100%;
z-index: 5;
background-color: rgba($gray-base, 0.4);
cursor: pointer;
pointer-events: none;
@include mixins.transition(0.5s);
}
border-right: 0.1rem solid $sidenav-divider-color;
background: none;

// Hide the body content and only show the sidenav.
#page-content {
display: none;
}

@at-root body.open_menu #page-content {
display: flex;
}
}

Expand Down Expand Up @@ -178,24 +167,27 @@ $sidenav-divider-color: #e7e8ed;
}

.navbar-nav {
display: none;
display: block;

a.nav-link {
font-size: 1.125rem;
margin-top: 0.5rem;
margin-bottom: 0.5rem;
padding: 0.375rem 0.6rem;
}

// Hide items from top navbar in wide layout to avoid duplication.
@media (min-width: $sidenav-wide-layout) {
display: none;
}
}
}

@media(max-width: 1024px) {
#sidenav {
display: none;
.site-header__search {
display: flex;

// The top-level navigation items in the mobile sidenav.
.navbar-nav {
display: block;
// Hide search from top navbar in wide layout.
@media (min-width: $sidenav-wide-layout) {
display: none;
}
}
}
6 changes: 4 additions & 2 deletions src/_sass/pages/_dash.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
$dash-max-width: 1330px;

body.homepage {
#sidenav {
display: none;
&:not(.open_menu) {
#sidenav {
display: none;
}
}

.dash-header-callout {
Expand Down
34 changes: 21 additions & 13 deletions src/_sass/pages/_error.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
@use '../base/variables' as *;

body.error {
#sidenav {
display: none;
&:not(.open_menu) {
#sidenav {
display: none;
}
}

.banner {
Expand All @@ -20,18 +22,28 @@ body.error {
h1 {
color: white;
font-family: $site-font-family-gsans-display;
font-size: 100px;
font-size: 8rem;
margin: 0 auto;
}

h2 {
color: white;
font-family: $site-font-family-gsans;
font-size: 24px;
margin: 8px auto 16px;
font-size: 2rem;
margin: 0 auto 16px;
}

#page-content {
padding: 1rem;

a {
color: $site-color-card-link;
}
}

#in-content-search {
max-width: 100%;

input[type="search"] {
display: inline-block;
background: #35404d;
Expand All @@ -41,15 +53,11 @@ body.error {
border-radius: 30px;
height: 70px;
line-height: 70px;
width: 100%;
max-width: 880px;
margin: 0 auto 88px;
}
}
width: 40rem;
max-width: 90%;
margin: 2rem 1rem;

.content {
a {
color: $site-color-card-link;
outline-offset: 2px;
}
}
}
2 changes: 1 addition & 1 deletion src/content/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<h1>404</h1>
<h2>Page not found</h2>

<div class="text-center content">
<div class="text-center">
<form action="/search" id="in-content-search">
<input type="hidden" name="cx" value="011220921317074318178:i4mscbaxtru">
<input type="hidden" name="ie" value="UTF-8">
Expand Down