Skip to content

Commit 26f1f7d

Browse files
committed
feat: header, params, edit-page-link
Enhance header navigation button with sublabel. Add sublabel to navigation button. Hide edit page link on smaller screens.
1 parent 6ef382c commit 26f1f7d

File tree

3 files changed

+28
-17
lines changed

3 files changed

+28
-17
lines changed

config/_default/params.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ preloader = "" # use jpg, png, svg or gif format.
4040
# Navigation button
4141
[navigation_button]
4242
enable = true
43-
label = "Join Discord (2100+ joined)"
43+
label = "Join Discord"
44+
label_sub = "(2100+ joined)"
4445
link = "https://discord.gg/hUygPUdD8E"
4546

4647
# search
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{{ if and .IsPage .File }}
2-
{{ with .File.Path }}
3-
{{ $dev_url := printf "https://github.dev/open-neuromorphic/open-neuromorphic.github.io/blob/main/content/%s" . }}
4-
<a href="{{ $dev_url }}" target="_blank" rel="noopener"
5-
class="btn normal-case inline-flex flex-shrink-0 items-center gap-x-1.5 rounded-md bg-white dark:bg-darkmode-theme-dark !px-2.5 !py-1 text-xs font-semibold text-gray-900 dark:text-gray-200 shadow-sm ring-1 ring-inset ring-gray-300 dark:ring-gray-700 hover:bg-gray-50 dark:hover:bg-black/20 transition-colors">
6-
{{ partial "icon.html" (dict "style" "brands" "name" "github" "class" "h-3.5 w-3.5") }}
7-
<span>Edit Page</span>
8-
{{ partial "icon.html" (dict "style" "solid" "name" "arrow-up-right-from-square" "class" "h-3 w-3") }}
9-
</a>
10-
{{ end }}
11-
{{ end }}
2+
{{ with .File.Path }}
3+
{{ $dev_url := printf "https://github.dev/open-neuromorphic/open-neuromorphic.github.io/blob/main/content/%s" . }}
4+
<a href="{{ $dev_url }}" target="_blank" rel="noopener"
5+
class="btn normal-case hidden md:inline-flex flex-shrink-0 items-center gap-x-1.5 rounded-md bg-white dark:bg-darkmode-theme-dark !px-2.5 !py-1 text-xs font-semibold text-gray-900 dark:text-gray-200 shadow-sm ring-1 ring-inset ring-gray-300 dark:ring-gray-700 hover:bg-gray-50 dark:hover:bg-black/20 transition-colors">
6+
{{ partial "icon.html" (dict "style" "brands" "name" "github" "class" "h-3.5 w-3.5") }}
7+
<span>Edit Page</span>
8+
{{ partial "icon.html" (dict "style" "solid" "name" "arrow-up-right-from-square" "class" "h-3 w-3") }}
9+
</a>
10+
{{ end }}
11+
{{ end }}

layouts/partials/essentials/header.html

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,16 @@
6868
{{ with site.Params.navigation_button }}
6969
{{ if .enable }}
7070
{{ $is_external := findRE `^http` .link }}
71-
<a href="{{ .link | relLangURL }}" class="btn-new-primary btn-sm hidden lg:inline-block" {{ if $is_external }}target="_blank" rel="noopener"{{ end }}>
72-
{{- .label -}}
73-
{{- if $is_external -}}
74-
{{- partial "icon.html" (dict "style" "solid" "name" "arrow-up-right-from-square" "class" "ml-1.5") -}}
75-
{{- end -}}
71+
<a href="{{ .link | relLangURL }}" class="btn btn-new-primary btn-sm !py-1 !px-3 hidden lg:inline-flex items-center" {{ if $is_external }}target="_blank" rel="noopener"{{ end }}>
72+
<div class="text-center">
73+
<span class="block text-sm font-semibold leading-tight">{{ .label }}</span>
74+
{{ with .label_sub }}
75+
<span class="block text-[10px] font-normal leading-tight opacity-80 -mt-px">{{ . }}</span>
76+
{{ end }}
77+
</div>
78+
{{- if $is_external -}}
79+
{{- partial "icon.html" (dict "style" "brands" "name" "discord" "class" "ml-2") -}}
80+
{{- end -}}
7681
</a>
7782
{{ end }}
7883
{{ end }}
@@ -124,7 +129,12 @@
124129
{{ if site.Params.navigation_button.enable }}
125130
<div class="p-4 mt-4 border-t border-border dark:border-darkmode-border">
126131
<a href="{{ site.Params.navigation_button.link | relLangURL }}" class="btn btn-new-primary w-full text-center">
127-
{{ site.Params.navigation_button.label }}
132+
<div class="text-center">
133+
<span class="block text-sm font-semibold leading-tight">{{ site.Params.navigation_button.label }}</span>
134+
{{ with site.Params.navigation_button.label_sub }}
135+
<span class="block text-[10px] font-normal leading-tight opacity-80 -mt-px">{{ . }}</span>
136+
{{ end }}
137+
</div>
128138
</a>
129139
</div>
130140
{{ end }}

0 commit comments

Comments
 (0)