mirror of
https://github.com/imfing/hextra.git
synced 2025-08-23 16:36:44 -04:00
refactor: extract navbar title as individual partial component (#718)
* feat: navbar title * fix: navbar title --------- Co-authored-by: Floren Munteanu <19806136+fmunteanu@users.noreply.github.com>
This commit is contained in:
0
layouts/_partials/custom/navbar-title.html
Normal file
0
layouts/_partials/custom/navbar-title.html
Normal file
16
layouts/_partials/navbar-title.html
Normal file
16
layouts/_partials/navbar-title.html
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{{- $logoPath := .Site.Params.navbar.logo.path | default "images/logo.svg" -}}
|
||||||
|
{{- $logoLink := .Site.Params.navbar.logo.link | default .Site.Home.RelPermalink -}}
|
||||||
|
{{- $logoWidth := .Site.Params.navbar.logo.width | default "20" -}}
|
||||||
|
{{- $logoHeight := .Site.Params.navbar.logo.height | default "20" -}}
|
||||||
|
{{- $logoDarkPath := .Site.Params.navbar.logo.dark | default $logoPath -}}
|
||||||
|
|
||||||
|
<a class="hx:flex hx:items-center hx:hover:opacity-75 hx:ltr:mr-auto hx:rtl:ml-auto" href="{{ $logoLink }}">
|
||||||
|
{{- $displayTitle := (.Site.Params.navbar.displayTitle | default true) }}
|
||||||
|
{{- if (.Site.Params.navbar.displayLogo | default true) }}
|
||||||
|
<img class="hx:mr-2 hx:block hx:dark:hidden" src="{{ $logoPath | relURL }}" alt="{{ cond $displayTitle `Logo` .Site.Title }}" height="{{ $logoHeight }}" width="{{ $logoWidth }}" />
|
||||||
|
<img class="hx:mr-2 hx:hidden hx:dark:block" src="{{ $logoDarkPath | relURL }}" alt="{{ cond $displayTitle `Dark Logo` .Site.Title }}" height="{{ $logoHeight }}" width="{{ $logoWidth }}" />
|
||||||
|
{{- end }}
|
||||||
|
{{- if $displayTitle }}
|
||||||
|
<span class="hx:mr-2 hx:font-extrabold hx:inline hx:select-none" title="{{ .Site.Title }}">{{- .Site.Title -}}</span>
|
||||||
|
{{- end }}
|
||||||
|
</a>
|
@@ -1,9 +1,3 @@
|
|||||||
{{- $logoPath := .Site.Params.navbar.logo.path | default "images/logo.svg" -}}
|
|
||||||
{{- $logoLink := .Site.Params.navbar.logo.link | default .Site.Home.RelPermalink -}}
|
|
||||||
{{- $logoWidth := .Site.Params.navbar.logo.width | default "20" -}}
|
|
||||||
{{- $logoHeight := .Site.Params.navbar.logo.height | default "20" -}}
|
|
||||||
{{- $logoDarkPath := .Site.Params.navbar.logo.dark | default $logoPath -}}
|
|
||||||
|
|
||||||
{{- $navWidth := "hx:max-w-[90rem]" -}}
|
{{- $navWidth := "hx:max-w-[90rem]" -}}
|
||||||
{{- with .Site.Params.navbar.width -}}
|
{{- with .Site.Params.navbar.width -}}
|
||||||
{{ if eq . "normal" -}}
|
{{ if eq . "normal" -}}
|
||||||
@@ -20,16 +14,7 @@
|
|||||||
></div>
|
></div>
|
||||||
|
|
||||||
<nav class="hextra-max-navbar-width hx:mx-auto hx:flex hx:items-center hx:justify-end hx:gap-2 hx:h-16 hx:px-6">
|
<nav class="hextra-max-navbar-width hx:mx-auto hx:flex hx:items-center hx:justify-end hx:gap-2 hx:h-16 hx:px-6">
|
||||||
<a class="hx:flex hx:items-center hx:hover:opacity-75 hx:ltr:mr-auto hx:rtl:ml-auto" href="{{ $logoLink }}">
|
{{ partial "navbar-title.html" . }}
|
||||||
{{- $displayTitle := (.Site.Params.navbar.displayTitle | default true) }}
|
|
||||||
{{- if (.Site.Params.navbar.displayLogo | default true) }}
|
|
||||||
<img class="hx:mr-2 hx:block hx:dark:hidden" src="{{ $logoPath | relURL }}" alt="{{ cond $displayTitle `Logo` .Site.Title }}" height="{{ $logoHeight }}" width="{{ $logoWidth }}" />
|
|
||||||
<img class="hx:mr-2 hx:hidden hx:dark:block" src="{{ $logoDarkPath | relURL }}" alt="{{ cond $displayTitle `Dark Logo` .Site.Title }}" height="{{ $logoHeight }}" width="{{ $logoWidth }}" />
|
|
||||||
{{- end }}
|
|
||||||
{{- if $displayTitle }}
|
|
||||||
<span class="hx:mr-2 hx:font-extrabold hx:inline hx:select-none" title="{{ .Site.Title }}">{{- .Site.Title -}}</span>
|
|
||||||
{{- end }}
|
|
||||||
</a>
|
|
||||||
|
|
||||||
{{- $currentPage := . -}}
|
{{- $currentPage := . -}}
|
||||||
{{- range .Site.Menus.main -}}
|
{{- range .Site.Menus.main -}}
|
||||||
|
Reference in New Issue
Block a user