Skip to content

Commit 74d9c19

Browse files
committed
Sidebar: Fixed all bugs + improved UX
1 parent 68bd3a9 commit 74d9c19

File tree

3 files changed

+54
-15
lines changed

3 files changed

+54
-15
lines changed

assets/css/v2/style.css

Lines changed: 51 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -527,39 +527,67 @@ nav {
527527
}
528528

529529
body:has(#sidebar-v2[style*="block"]) {
530+
/* Disable scrolling in main content + hide footer if the sidebar is visible */
530531
overflow-y: hidden;
532+
533+
.sidebar-layout {
534+
position: absolute;
535+
height: 100%;
536+
}
537+
538+
footer {
539+
display: none;
540+
}
541+
542+
.sidebar-layout .sidebar-mobile-toggle {
543+
display: flex !important;
544+
align-items: center;
545+
position: sticky;
546+
top: 1rem;
547+
margin-top: 2rem;
548+
padding: 0.5rem;
549+
color: white;
550+
background-color: oklch(var(--color-brand));
551+
}
552+
}
553+
554+
.breadcrumb .sidebar-mobile-toggle {
555+
display: inline !important;
556+
}
557+
558+
.sidebar-mobile-toggle {
559+
background-color: transparent;
560+
border: none;
561+
562+
.lucide {
563+
width: 1rem;
564+
height: 1rem;
565+
margin-right: 1rem;
566+
}
531567
}
532568

533569
.main-layout {
570+
/* Mobile support for sidebar */
534571
display: flex;
535572
flex-direction: column;
536573
position: relative;
537574

538575
.sidebar-layout {
539576
min-height: fit-content;
540-
position: sticky;
541-
top: 0;
542-
padding: 1rem;
543-
background-color: white;
577+
background: white;
578+
z-index: 3;
544579
width: calc(100% + 4rem);
545580
margin-left: -2rem;
546-
overflow-y: scroll;
547581

548582
&::before {
549583
display: none;
550584
}
551585

552-
.sidebar-mobile-toggle {
553-
background-color: oklch(var(--color-brand));
554-
color: white;
555-
border: none;
556-
display: block !important;
557-
}
558-
559586
nav {
560587
width: 100%;
561-
height: 100vh;
562588
display: none;
589+
padding: 0;
590+
top: 3rem;
563591

564592
.sidebar__container {
565593
width: 100%;
@@ -981,6 +1009,16 @@ p {
9811009
line-height: 1.5rem;
9821010
}
9831011

1012+
.breadcrumb-layout {
1013+
position: sticky;
1014+
top: 0;
1015+
z-index: 3;
1016+
background-color: white;
1017+
width: calc(100% + 4rem);
1018+
margin-left: -2rem;
1019+
padding: 1rem 2rem;
1020+
}
1021+
9841022
.breadcrumb {
9851023
color: var(--color-foreground);
9861024
text-decoration: none;

layouts/_default/docs.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@
6969

7070
<section class="main-layout">
7171
<div class="sidebar-layout" id="sidebar-layout">
72-
<button class="sidebar-mobile-toggle" aria-expanded="false" style="display: none;"><p>Click</p></button>
73-
<nav data-mf="true" id="sidebar-v2" class="sidebar" style="display:none;">
72+
<button class="sidebar-mobile-toggle" style="display: none;" aria-expanded="false">{{ partial "lucide" (dict "context" . "icon" "x")}}Close</button>
73+
<nav data-mf="true" id="sidebar-v2" class="sidebar">
7474
{{ partial "sidebar-v2.html" . }}
7575
</nav>
7676
</div>

layouts/partials/breadcrumb.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<nav aria-label="breadcrumb" class="breadcrumb navbar">
22
<div class="nav flex-md-row">
33
<ol class="breadcrumb">
4+
<button class="sidebar-mobile-toggle" aria-expanded="false" style="display: none;">{{ partial "lucide" (dict "context" . "icon" "align-justify") }}</button>
45
<li><a href="/" alt="NGINX Docs Home">Home</a></li>
56
{{- define "breadcrumb" -}}
67
{{- with .Parent -}}

0 commit comments

Comments
 (0)