Extract the "scroll to top" section as a partial

This commit is contained in:
Mircea-Pavel ANTON 2023-01-07 03:44:09 +02:00
parent e6e8b05e07
commit 1460aefdd6
2 changed files with 8 additions and 7 deletions

View file

@ -26,13 +26,7 @@
<main id="main-content" class="grow">
{{ block "main" . }}{{ end }}
{{ if and (.Site.Params.footer.showScrollToTop | default true) (gt .WordCount 1) }}
<div class="pointer-events-none absolute top-[100vh] bottom-0 w-12 ltr:right-0 rtl:left-0">
<a href="#the-top"
class="pointer-events-auto sticky top-[calc(100vh-5.5rem)] flex h-12 w-12 mb-16 items-center justify-center rounded-full bg-neutral/50 text-xl text-neutral-700 backdrop-blur hover:text-primary-600 dark:bg-neutral-800/50 dark:text-neutral dark:hover:text-primary-400"
aria-label="{{ i18n " nav.scroll_to_top_title" }}" title="{{ i18n " nav.scroll_to_top_title" }}">
&uarr;
</a>
</div>
{{- partial "scroll-to-top.html" . -}}
{{ end }}
</main>
{{- partial "footer.html" . -}}

View file

@ -0,0 +1,7 @@
<div class="pointer-events-none absolute top-[100vh] bottom-0 w-12 ltr:right-0 rtl:left-0">
<a href="#the-top"
class="pointer-events-auto sticky top-[calc(100vh-5.5rem)] flex h-12 w-12 mb-16 items-center justify-center rounded-full bg-neutral/50 text-xl text-neutral-700 backdrop-blur hover:text-primary-600 dark:bg-neutral-800/50 dark:text-neutral dark:hover:text-primary-400"
aria-label="{{ i18n " nav.scroll_to_top_title" }}" title="{{ i18n " nav.scroll_to_top_title" }}">
&uarr;
</a>
</div>