Compare commits

...

5 Commits

Author SHA1 Message Date
Jason A. Dour
bd7e9b7634
Merge da56d153aa6884666e94747a3de0dba4bbe9b612 into 0c90c1aa500dd1da473c474202b38fb82bcb5188 2024-12-10 19:14:19 -05:00
Floren Munteanu
0c90c1aa50
feat: add hextra hero-section shortcode (#390)
Some checks failed
Deploy Hugo site to Pages / build (push) Has been cancelled
Deploy Hugo site to Pages / deploy (push) Has been cancelled
* Implement hextra hero-section

* Implement header size

* Update layouts/shortcodes/hextra/hero-section.html

* Update layouts/shortcodes/hextra/hero-section.html

* Update layouts/shortcodes/hextra/hero-section.html

* Update layouts/shortcodes/hextra/hero-section.html

---------

Co-authored-by: Xin <fuxin1997@gmail.com>
2024-12-10 23:58:36 +00:00
Jason A. Dour
da56d153aa
Added logic for font size in theme toggle when in navbar. 2024-11-17 17:34:13 -05:00
Jason A. Dour
5c0698c3c0
Fix icon size in navbar theme toggle.
- Add navbar boolean to theme-toggle partial arguments.
- Add logic in theme-toggle to set icon size based on navbar boolean.
2024-11-16 18:34:30 -05:00
Jason A. Dour
ebdaf0fd4a
Implement theme toggle in navbar.
- Add additional logic for navbar partial.
- Uses a menu item params.type of `theme-toggle`.
- Uses additional params.hideLabel boolean to set hideLabel for the theme-toggle.html partial.
2024-11-16 17:44:16 -05:00
3 changed files with 23 additions and 4 deletions

View File

@ -31,6 +31,8 @@
{{- range .Site.Menus.main -}} {{- range .Site.Menus.main -}}
{{- if eq .Params.type "search" -}} {{- if eq .Params.type "search" -}}
{{- partial "search.html" (dict "params" .Params) -}} {{- partial "search.html" (dict "params" .Params) -}}
{{- else if eq .Params.type "theme-toggle" -}}
{{- partial "theme-toggle.html" (dict "navbar" true "hideLabel" (.Params.hideLabel | default true)) -}}
{{- else -}} {{- else -}}
{{- $link := .URL -}} {{- $link := .URL -}}
{{- $external := strings.HasPrefix $link "http" -}} {{- $external := strings.HasPrefix $link "http" -}}
@ -67,4 +69,4 @@
{{- partial "utils/icon.html" (dict "name" "hamburger-menu" "attributes" "height=24") -}} {{- partial "utils/icon.html" (dict "name" "hamburger-menu" "attributes" "height=24") -}}
</button> </button>
</nav> </nav>
</div> </div>

View File

@ -1,3 +1,10 @@
{{- $navbar := .navbar | default false -}}
{{- $height_px := 12 -}}
{{- $height_tw := "hx-text-xs" -}}
{{- if $navbar -}}
{{- $height_px = 24 -}}
{{- $height_tw = "hx-text-sm" -}}
{{- end -}}
{{- $hideLabel := .hideLabel | default false -}} {{- $hideLabel := .hideLabel | default false -}}
{{- $changeTheme := (T "changeTheme") | default "Change theme" -}} {{- $changeTheme := (T "changeTheme") | default "Change theme" -}}
@ -8,14 +15,14 @@
<button <button
title="{{ $changeTheme }}" title="{{ $changeTheme }}"
data-theme="light" data-theme="light"
class="theme-toggle hx-group hx-h-7 hx-rounded-md hx-px-2 hx-text-left hx-text-xs hx-font-medium hx-text-gray-600 hx-transition-colors dark:hx-text-gray-400 hover:hx-bg-gray-100 hover:hx-text-gray-900 dark:hover:hx-bg-primary-100/5 dark:hover:hx-text-gray-50" class="theme-toggle hx-group hx-h-7 hx-rounded-md hx-px-2 hx-text-left {{ $height_tw }} hx-font-medium hx-text-gray-600 hx-transition-colors dark:hx-text-gray-400 hover:hx-bg-gray-100 hover:hx-text-gray-900 dark:hover:hx-bg-primary-100/5 dark:hover:hx-text-gray-50"
type="button" type="button"
aria-label="{{ $changeTheme }}" aria-label="{{ $changeTheme }}"
> >
<div class="hx-flex hx-items-center hx-gap-2 hx-capitalize"> <div class="hx-flex hx-items-center hx-gap-2 hx-capitalize">
{{- partial "utils/icon.html" (dict "name" "sun" "attributes" "height=12 class=\"group-data-[theme=light]:hx-hidden\"") -}} {{- partial "utils/icon.html" (dict "name" "sun" "attributes" (printf "height=%d class=\"group-data-[theme=light]:hx-hidden\"" $height_px)) -}}
{{- if not $hideLabel }}<span class="group-data-[theme=light]:hx-hidden">{{ $light }}</span>{{ end -}} {{- if not $hideLabel }}<span class="group-data-[theme=light]:hx-hidden">{{ $light }}</span>{{ end -}}
{{- partial "utils/icon.html" (dict "name" "moon" "attributes" "height=12 class=\"group-data-[theme=dark]:hx-hidden\"") -}} {{- partial "utils/icon.html" (dict "name" "moon" "attributes" (printf "height=%d class=\"group-data-[theme=dark]:hx-hidden\"" $height_px)) -}}
{{- if not $hideLabel }}<span class="group-data-[theme=dark]:hx-hidden">{{ $dark }}</span>{{ end -}} {{- if not $hideLabel }}<span class="group-data-[theme=dark]:hx-hidden">{{ $dark }}</span>{{ end -}}
</div> </div>
</button> </button>

View File

@ -0,0 +1,10 @@
{{- $style := .Get "style" -}}
{{- $heading := int (strings.TrimPrefix "h" (.Get "heading" | default "h2")) -}}
{{- $size := cond (ge $heading 4) "xl" (cond (eq $heading 3) "2xl" "4xl") -}}
<h{{ $heading }}
class="not-prose hx-text-{{ $size }} hx-font-bold hx-leading-none hx-tracking-tighter md:hx-text-3xl hx-py-2 hx-bg-clip-text hx-text-transparent hx-bg-gradient-to-r hx-from-gray-900 hx-to-gray-600 dark:hx-from-gray-100 dark:hx-to-gray-400"
{{ with $style }}style="{{ . | safeCSS }}"{{ end }}
>
{{ .Inner | markdownify }}
</h{{ $heading }}>