Skip to content

Commit 05de4ce

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

File tree

3 files changed

+50
-15
lines changed

3 files changed

+50
-15
lines changed

assets/css/v2/style.css

Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -527,39 +527,63 @@ 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+
height: 100vh;
535+
}
536+
537+
footer {
538+
display: none;
539+
}
540+
541+
.sidebar-layout .sidebar-mobile-toggle {
542+
display: flex !important;
543+
align-items: center;
544+
margin-top: 2rem;
545+
padding: 0.5rem;
546+
color: white;
547+
background-color: oklch(var(--color-brand));
548+
}
549+
}
550+
551+
.breadcrumb .sidebar-mobile-toggle {
552+
display: inline !important;
553+
}
554+
555+
.sidebar-mobile-toggle {
556+
background-color: transparent;
557+
border: none;
558+
559+
.lucide {
560+
width: 1rem;
561+
height: 1rem;
562+
margin-right: 1rem;
563+
}
531564
}
532565

533566
.main-layout {
567+
/* Mobile support for sidebar */
534568
display: flex;
535569
flex-direction: column;
536570
position: relative;
537571

538572
.sidebar-layout {
539573
min-height: fit-content;
540-
position: sticky;
541-
top: 0;
542-
padding: 1rem;
543-
background-color: white;
574+
background: white;
575+
z-index: 3;
544576
width: calc(100% + 4rem);
545577
margin-left: -2rem;
546-
overflow-y: scroll;
547578

548579
&::before {
549580
display: none;
550581
}
551582

552-
.sidebar-mobile-toggle {
553-
background-color: oklch(var(--color-brand));
554-
color: white;
555-
border: none;
556-
display: block !important;
557-
}
558-
559583
nav {
560584
width: 100%;
561-
height: 100vh;
562585
display: none;
586+
padding: 0;
563587

564588
.sidebar__container {
565589
width: 100%;
@@ -981,6 +1005,16 @@ p {
9811005
line-height: 1.5rem;
9821006
}
9831007

1008+
.breadcrumb-layout {
1009+
position: sticky;
1010+
top: 0;
1011+
z-index: 3;
1012+
background-color: white;
1013+
width: calc(100% + 4rem);
1014+
margin-left: -2rem;
1015+
padding: 1rem 2rem;
1016+
}
1017+
9841018
.breadcrumb {
9851019
color: var(--color-foreground);
9861020
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)