Skip to content

Commit aff6069

Browse files
committed
Sidebar: Add fixed position for mobile view
Move search to sidebar for mobile view
1 parent e8c96a4 commit aff6069

File tree

3 files changed

+36
-29
lines changed

3 files changed

+36
-29
lines changed

assets/css/v2/style.css

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,12 @@ ol li:last-child {
550550
display: flex;
551551
align-self: center;
552552
}
553+
554+
.header {
555+
.header__logo-small {
556+
display: unset;
557+
}
558+
}
553559
}
554560

555561
/* sidebar layout */
@@ -614,6 +620,10 @@ ol li:last-child {
614620
scrollbar-gutter: stable;
615621
}
616622
}
623+
624+
.sidebar__search {
625+
display: none;
626+
}
617627
}
618628

619629
/* This is our "mobile" or no sidebar breakpoint */
@@ -622,10 +632,20 @@ ol li:last-child {
622632
.sidebar {
623633
/* Above search */
624634
z-index: 11;
625-
display: unset;
635+
display: block;
626636
transform: translateX(0);
627637
border-bottom: 1px solid oklch(var(--color-divider));
628638
height: fit-content;
639+
position: fixed;
640+
top: 0;
641+
left: 0;
642+
643+
.sidebar__search {
644+
display: flex;
645+
width: calc(var(--sidebar-width) - 4rem);
646+
justify-self: anchor-center;
647+
margin-left: -1rem;
648+
}
629649
}
630650
}
631651

@@ -636,6 +656,11 @@ ol li:last-child {
636656
margin: 0;
637657
}
638658
}
659+
.header-container {
660+
.header__search {
661+
display: none;
662+
}
663+
}
639664
}
640665

641666
.header__product-selector {

layouts/partials/header.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
{{ define "header" }}
22
<div class="header-container">
3+
<div class="header__sidebar__panel">
4+
<label for="sidebar-panel">
5+
{{ partial "lucide" (dict "context" . "icon" "panel-left-open") }}
6+
</label>
7+
</div>
38

49
<div class="header__logo-small">
510
<a href="{{ .Site.BaseURL | relLangURL }}" alt="NGINX Docs Home">
611
<img class="header__img" src="{{ "/images/icons/NGINX-product-icon.svg" | absURL }}" alt="NGINX Docs">
712
</a>
813
</div>
14+
915
<div class="header__logo">
1016
<a href="{{ .Site.BaseURL | relLangURL }}" alt="NGINX Docs Home">
1117
<img class="header__img" src="{{ "/images/icons/NGINX-Docs-horiz-black-type.svg" | absURL }}" alt="NGINX Docs">
1218
</a>
1319
</div>
1420

15-
<div class="header__sidebar__panel">
16-
<label for="sidebar-panel">
17-
{{ partial "lucide" (dict "context" . "icon" "panel-left-open") }}
18-
</label>
19-
</div>
20-
2121
<div class="header__product-selector">
2222
{{ $nginxProducts := slice
2323
(dict "title" "NGINX One Console" "url" "/nginx-one" "type" "nginx-one")

layouts/partials/sidebar-v2.html

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,3 @@
1-
{{ $nginxProducts := slice
2-
(dict "title" "NGINX One Console" "url" "/nginx-one" "type" "nginx-one")
3-
(dict "title" "NGINX Plus" "url" "/nginx" "type" "nginx-one")
4-
(dict "title" "NGINX Instance Manager" "url" "/nginx-instance-manager" "type" "nginx-one")
5-
(dict "title" "NGINX Ingress Controller" "url" "/nginx-ingress-controller" "type" "nginx-one")
6-
(dict "title" "NGINX Gateway Fabric" "url" "/nginx-gateway-fabric" "type" "nginx-one")
7-
(dict "title" "NGINX Open Source" "url" "https://nginx.org/en/docs/" "type" "nginx-one")
8-
(dict "title" "Subscription Licensing & Solutions" "url" "/solutions/" "type" "nginx-one")
9-
(dict "title" "NGINX Agent" "url" "/nginx-agent" "type" "nginx-one")
10-
(dict "title" "NGINX App Protect WAF" "url" "/nginx-app-protect-waf" "type" "nginx-app-protect")
11-
(dict "title" "NGINX App Protect DoS" "url" "/nginx-app-protect-dos" "type" "nginx-app-protect")
12-
(dict "title" "NGINX as a Service for Azure" "url" "/nginxaas/azure/" "type" "nginx-as-a-service")
13-
(dict "title" "NGINX Unit" "url" "https://unit.nginx.org/" "type" "nginx-other")
14-
}}
15-
{{ $productMap := dict }}
16-
{{ range $nginxProducts }}
17-
{{ $productId := index (split .url "/") 1 }}
18-
{{ $productMap = merge $productMap (dict $productId .title) }}
19-
{{ end }}
20-
{{ $relPermalink := .RelPermalink }}
21-
{{ $productIdentifier := index ((split $relPermalink "/")) 1 }}
22-
{{ $productName := index $productMap $productIdentifier }}
231

242
<div class="sidebar__container">
253
<div class="sidebar__header">
@@ -34,6 +12,10 @@
3412
</label>
3513
</div>
3614
</div>
15+
<div class="sidebar__search">
16+
<!-- Standalone search box. -->
17+
{{ partial "coveo-atomic-search.html" }}
18+
</div>
3719
<div class="sidebar__content">
3820
<a class="skip-link" href="#maincontent">Skip Navigation</a>
3921
{{ partial "sidebar-list.html" (dict

0 commit comments

Comments
 (0)