Skip to content

Commit 995cced

Browse files
committed
switch solutions tab from button to dropdown
1 parent f0dd70a commit 995cced

2 files changed

Lines changed: 41 additions & 2 deletions

File tree

data/nav.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- Separator: true
88
- Path: "/downloads"
99
- Path: "/solutions"
10+
DropdownFromSection: true
1011
- Path: "/pricing"
1112
- Title: nav_support_us
1213
Dropdown:

layouts/partials/nav.html

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,30 @@
2525

2626
<ul class="hidden lg:flex items-stretch list-none m-0">
2727
{{- range .Site.Data.nav }}
28-
{{- if .Dropdown }}
28+
{{- if .DropdownFromSection }}
29+
<!-- Dropdown generated from a section's child pages (e.g. Solutions) -->
30+
{{- with $.Site.GetPage .Path }}
31+
<li x-data="{ isDropdownOpen: false, openedByHover: false }" class="flex items-center mx-2 border-b-2 border-transparent" @mouseenter="isDropdownOpen = true; openedByHover = true" @mouseleave="isDropdownOpen = false; openedByHover = false" @click.outside="isDropdownOpen = false">
32+
<button @click="if (!openedByHover) { isDropdownOpen = !isDropdownOpen }" class="whitespace-nowrap p-2">
33+
<span>{{ .Title }}</span>
34+
<i class="fa-solid fa-chevron-down text-xs"></i>
35+
</button>
36+
<div class="absolute">
37+
<ul x-show="isDropdownOpen" x-cloak class="absolute mt-6 py-2 whitespace-nowrap bg-white rounded-sm shadow-md z-50">
38+
{{- range .Pages.ByWeight }}
39+
{{- if not .Params.comingsoon }}
40+
<li>
41+
<a href="{{ .RelPermalink }}" class="flex items-center px-4 py-2 text-gray-800 hover:bg-secondary hover:text-white hover:no-underline" data-umami-event="nav-{{ replaceRE "^.*/([^/]+)/?$" "$1" .RelPermalink }}">
42+
<span>{{ .Params.cardtitle | default .Title }}</span>
43+
</a>
44+
</li>
45+
{{- end }}
46+
{{- end }}
47+
</ul>
48+
</div>
49+
</li>
50+
{{- end }}
51+
{{- else if .Dropdown }}
2952
<!-- Dropdown item -->
3053
<li x-data="{ isDropdownOpen: false, openedByHover: false }" class="flex items-center mx-2 border-b-2 border-transparent" @mouseenter="isDropdownOpen = true; openedByHover = true" @mouseleave="isDropdownOpen = false; openedByHover = false" @click.outside="isDropdownOpen = false">
3154
<button @click="if (!openedByHover) { isDropdownOpen = !isDropdownOpen }" class="whitespace-nowrap p-2">
@@ -120,7 +143,22 @@
120143
<!-- Smartphone Navigation -->
121144
<div :class="isNavOpen ? 'block' : 'hidden'" x-cloak class="lg:hidden {{ cond (.Scratch.Get "webinarBannerActive") "max-h-[calc(100vh-72px)]" "max-h-[calc(100vh-48px)]" }} overflow-y-auto">
122145
{{- range .Site.Data.nav }}
123-
{{- if .Dropdown }}
146+
{{- if .DropdownFromSection }}
147+
<!-- Dropdown generated from a section's child pages (e.g. Solutions) -->
148+
{{- with $.Site.GetPage .Path }}
149+
<div class="uppercase tracking-wide text-gray-500 text-xs font-bold p-2">
150+
{{ .Title }}
151+
</div>
152+
{{- range .Pages.ByWeight }}
153+
{{- if not .Params.comingsoon }}
154+
<a class="flex items-center py-2 mx-2 hover:text-secondary hover:no-underline" href="{{ .RelPermalink }}" data-umami-event="nav-{{ replaceRE "^.*/([^/]+)/?$" "$1" .RelPermalink }}">
155+
<span>{{ .Params.cardtitle | default .Title }}</span>
156+
</a>
157+
{{- end }}
158+
{{- end }}
159+
<hr class="border-primary my-2"/>
160+
{{- end }}
161+
{{- else if .Dropdown }}
124162
<div class="uppercase tracking-wide text-gray-500 text-xs font-bold p-2">
125163
{{ i18n .Title . }}
126164
</div>

0 commit comments

Comments
 (0)