mirror of
https://github.com/imfing/hextra.git
synced 2025-05-17 15:28:29 -04:00
Compare commits
24 Commits
4bf9475701
...
1b2855fca6
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1b2855fca6 | ||
![]() |
66d2bf57ba | ||
![]() |
526be88d7b | ||
![]() |
2863a3a029 | ||
![]() |
852a07b15e | ||
![]() |
9e7b13a0da | ||
![]() |
66489e5274 | ||
![]() |
2004648076 | ||
![]() |
0da6f97e99 | ||
![]() |
a4bfa2d97e | ||
![]() |
3a2ce0b5c0 | ||
![]() |
55af474f51 | ||
![]() |
b91cc79674 | ||
![]() |
68e1e25119 | ||
![]() |
8c789626be | ||
![]() |
a1c7acd6b5 | ||
![]() |
e444156bb9 | ||
![]() |
33f2cf653b | ||
![]() |
63f153999e | ||
![]() |
c62b1fd401 | ||
![]() |
fdfdef69b5 | ||
![]() |
462cc5b68d | ||
![]() |
f40c7fd5d4 | ||
![]() |
74fb165358 |
@ -1,5 +1,5 @@
|
||||
/*
|
||||
! tailwindcss v3.4.9 | MIT License | https://tailwindcss.com
|
||||
! tailwindcss v3.4.10 | MIT License | https://tailwindcss.com
|
||||
*//*
|
||||
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
|
||||
2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
|
||||
|
@ -1,5 +1,5 @@
|
||||
@media (max-width: 767px) {
|
||||
.sidebar-container {
|
||||
.hextra-sidebar-container {
|
||||
@apply hx-fixed hx-pt-[calc(var(--navbar-height))] hx-top-0 hx-w-full hx-bottom-0 hx-z-[15] hx-overscroll-contain hx-bg-white dark:hx-bg-dark;
|
||||
transition: transform 0.8s cubic-bezier(0.52, 0.16, 0.04, 1);
|
||||
will-change: transform, opacity;
|
||||
@ -8,7 +8,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar-container {
|
||||
.hextra-sidebar-container {
|
||||
li > div {
|
||||
@apply hx-h-0;
|
||||
}
|
||||
@ -18,4 +18,19 @@
|
||||
li.open > a > span > svg > path {
|
||||
@apply hx-rotate-90;
|
||||
}
|
||||
|
||||
.hextra-sidebar-item-list {
|
||||
@apply hx-relative hx-flex hx-flex-col hx-gap-1 before:hx-absolute before:hx-inset-y-1 before:hx-w-px before:hx-bg-gray-200 ltr:hx-ml-3 ltr:hx-pl-3 ltr:before:hx-left-0 rtl:hx-mr-3 rtl:hx-pr-3 rtl:before:hx-right-0 dark:before:hx-bg-neutral-800;
|
||||
}
|
||||
|
||||
.hextra-sidebar-item-link {
|
||||
@apply hx-flex hx-items-center hx-justify-between hx-gap-2 hx-cursor-pointer hx-rounded hx-px-2 hx-py-1.5 hx-text-sm hx-transition-colors;
|
||||
|
||||
&.active {
|
||||
@apply hx-bg-primary-100 hx-font-semibold hx-text-primary-800 contrast-more:hx-border contrast-more:hx-border-primary-500 dark:hx-bg-primary-400/10 dark:hx-text-primary-600 contrast-more:dark:hx-border-primary-500;
|
||||
}
|
||||
&.inactive {
|
||||
@apply hx-text-gray-500 hover:hx-bg-gray-100 hover:hx-text-gray-900 contrast-more:hx-border contrast-more:hx-border-transparent contrast-more:hx-text-gray-900 contrast-more:hover:hx-border-gray-900 dark:hx-text-neutral-400 dark:hover:hx-bg-primary-100/5 dark:hover:hx-text-gray-50 contrast-more:dark:hx-text-gray-50 contrast-more:dark:hover:hx-border-gray-50;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const menu = document.querySelector('.hamburger-menu');
|
||||
const overlay = document.querySelector('.mobile-menu-overlay');
|
||||
const sidebarContainer = document.querySelector('.sidebar-container');
|
||||
const sidebarContainer = document.querySelector('.hextra-sidebar-container');
|
||||
|
||||
// Initialize the overlay
|
||||
const overlayClasses = ['hx-fixed', 'hx-inset-0', 'hx-z-10', 'hx-bg-black/80', 'dark:hx-bg-black/60'];
|
||||
|
@ -1,3 +1,12 @@
|
||||
/**
|
||||
* Check if the element is visible.
|
||||
* @param {Element} element Dom element
|
||||
* @returns boolean
|
||||
*/
|
||||
function isVisible(element) {
|
||||
return element.offsetWidth > 0 || element.offsetHeight > 0;
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const buttons = document.querySelectorAll(".hextra-sidebar-collapsible-button");
|
||||
buttons.forEach(function (button) {
|
||||
@ -5,8 +14,41 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
e.preventDefault();
|
||||
const list = button.parentElement.parentElement;
|
||||
if (list) {
|
||||
list.classList.toggle("open")
|
||||
list.classList.toggle("open");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const isCached = "{{- site.Params.page.sidebar.cache | default false -}}" === "true";
|
||||
const currentPagePath = window.location.href;
|
||||
|
||||
if (isCached) {
|
||||
// find the current page in the sidebar and open the parent lists
|
||||
const sidebar = document.querySelector(".hextra-sidebar-container");
|
||||
if (sidebar) {
|
||||
// find a tags and compare href with current page path
|
||||
const links = sidebar.querySelectorAll("a");
|
||||
links.forEach(function (link) {
|
||||
const linkPath = link.href;
|
||||
|
||||
if (currentPagePath === linkPath) {
|
||||
// add active class to the link
|
||||
link.classList.add("active");
|
||||
link.classList.remove("inactive");
|
||||
|
||||
if (!isVisible(link)) {
|
||||
return;
|
||||
}
|
||||
// recursively open parent lists
|
||||
let parent = link.parentElement;
|
||||
while (parent && !parent.classList.contains("hextra-sidebar-container")) {
|
||||
if (parent.tagName === "LI" && parent.classList.contains("hextra-sidebar-item")) {
|
||||
parent.classList.add("open");
|
||||
}
|
||||
parent = parent.parentElement;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -54,7 +54,7 @@ jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
HUGO_VERSION: 0.121.2
|
||||
HUGO_VERSION: 0.131.0
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
@ -64,7 +64,7 @@ jobs:
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.21'
|
||||
go-version: '1.22'
|
||||
- name: Setup Pages
|
||||
id: pages
|
||||
uses: actions/configure-pages@v4
|
||||
@ -146,7 +146,7 @@ For more details, check out:
|
||||
3. If you are not using [hextra-starter-template][hextra-starter-template], configure the following manually:
|
||||
- Configure the Build command to `hugo --gc --minify`
|
||||
- Specify the Publish directory to `public`
|
||||
- Add Environment variable `HUGO_VERSION` and set to `0.119.0`
|
||||
- Add Environment variable `HUGO_VERSION` and set to `0.132.2`
|
||||
4. Deploy!
|
||||
|
||||
Check [Hugo on Netlify](https://docs.netlify.com/integrations/frameworks/hugo/) for more details.
|
||||
|
@ -9,7 +9,6 @@ next: /docs/guide/shortcodes/callout
|
||||
|
||||
Hextra provides a collection of beautiful shortcodes to enhance your content.
|
||||
|
||||
|
||||
{{< cards >}}
|
||||
{{< card link="callout" title="Callout" icon="warning" >}}
|
||||
{{< card link="cards" title="Cards" icon="card" >}}
|
||||
@ -19,3 +18,11 @@ Hextra provides a collection of beautiful shortcodes to enhance your content.
|
||||
{{< card link="steps" title="Steps" icon="one" >}}
|
||||
{{< card link="tabs" title="Tabs" icon="collection" >}}
|
||||
{{< /cards >}}
|
||||
|
||||
<div style="padding-top:4rem"></div>
|
||||
|
||||
Additional shortcodes provided by Hugo and Hextra:
|
||||
|
||||
{{< cards >}}
|
||||
{{< card link="others" title="Others" icon="view-grid" >}}
|
||||
{{< /cards >}}
|
||||
|
43
exampleSite/content/docs/guide/shortcodes/others.md
Normal file
43
exampleSite/content/docs/guide/shortcodes/others.md
Normal file
@ -0,0 +1,43 @@
|
||||
---
|
||||
title: Other Shortcodes
|
||||
linkTitle: Others
|
||||
sidebar:
|
||||
exclude: true
|
||||
---
|
||||
|
||||
{{< callout emoji="ℹ️" >}}
|
||||
Some of these are Hugo built-in shortcodes.
|
||||
These shortcodes are considered less stable and may be changed anytime.
|
||||
{{< /callout >}}
|
||||
|
||||
## YouTube
|
||||
|
||||
Embed a YouTube video.
|
||||
|
||||
```
|
||||
{{</* youtube VIDEO_ID */>}}
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
{{< youtube id=dQw4w9WgXcQ loading=lazy >}}
|
||||
|
||||
For more information, see [Hugo's YouTube Shortcode](https://gohugo.io/content-management/shortcodes/#youtube).
|
||||
|
||||
## PDF
|
||||
|
||||
With PDF shortcode, you can embed a PDF file in your content.
|
||||
|
||||
```
|
||||
{{</* pdf "https://example.com/sample.pdf" */>}}
|
||||
```
|
||||
|
||||
You can also place the PDF file in your project directory and use the relative path.
|
||||
|
||||
```
|
||||
{{</* pdf "path/to/file.pdf" */>}}
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
{{< pdf "https://upload.wikimedia.org/wikipedia/commons/1/13/Example.pdf" >}}
|
@ -25,6 +25,11 @@ This is the third step.
|
||||
|
||||
## Usage
|
||||
|
||||
{{< callout emoji="ℹ️" >}}
|
||||
Please note that this shortcode is intended **only for Markdown content**.
|
||||
If you put HTML content or other shortcodes as step content, it may not render as expected.
|
||||
{{< /callout >}}
|
||||
|
||||
Put Markdown h3 header within `steps` shortcode.
|
||||
|
||||
```
|
||||
|
@ -27,6 +27,7 @@
|
||||
"head",
|
||||
"hr",
|
||||
"html",
|
||||
"iframe",
|
||||
"img",
|
||||
"input",
|
||||
"kbd",
|
||||
@ -221,6 +222,7 @@
|
||||
"hextra-filetree",
|
||||
"hextra-filetree-folder",
|
||||
"hextra-footer",
|
||||
"hextra-pdf",
|
||||
"hextra-scrollbar",
|
||||
"hextra-sidebar-collapsible-button",
|
||||
"hextra-tabs-panel",
|
||||
|
12
layouts/partials/components/sidebar/bottom.html
Normal file
12
layouts/partials/components/sidebar/bottom.html
Normal file
@ -0,0 +1,12 @@
|
||||
{{- range site.Menus.sidebar }}
|
||||
{{- $name := or (T .Identifier) .Name }}
|
||||
{{- if eq .Params.type "separator" }}
|
||||
<li class="[word-break:break-word] hx-mt-5 hx-mb-2 hx-px-2 hx-py-1.5 hx-text-sm hx-font-semibold hx-text-gray-900 first:hx-mt-0 dark:hx-text-gray-100">
|
||||
<span class="hx-cursor-default">{{ $name }}</span>
|
||||
</li>
|
||||
{{- else }}
|
||||
<li>
|
||||
{{- partial "components/sidebar/item-link" (dict "active" false "title" $name "link" (.URL | relLangURL)) -}}
|
||||
</li>
|
||||
{{- end }}
|
||||
{{- end -}}
|
@ -0,0 +1,5 @@
|
||||
<span class="hextra-sidebar-collapsible-button">
|
||||
<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="hx-h-[18px] hx-min-w-[18px] hx-rounded-sm hx-p-0.5 hover:hx-bg-gray-800/5 dark:hover:hx-bg-gray-100/5">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" class="hx-origin-center hx-transition-transform rtl:-hx-rotate-180"></path>
|
||||
</svg>
|
||||
</span>
|
@ -0,0 +1,51 @@
|
||||
{{- $context := . -}}
|
||||
|
||||
{{- $pages := union .RegularPages .Sections -}}
|
||||
{{- $pages = where $pages "Params.sidebar.exclude" "!=" true -}}
|
||||
|
||||
{{- $data := slice -}}
|
||||
|
||||
{{- range $pages.ByWeight -}}
|
||||
{{ $structure := (partial "sidebar/section-walk" .) | unmarshal -}}
|
||||
{{ $data = $data | append $structure -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- define "partials/sidebar/section-walk" -}}
|
||||
{{- with . -}}
|
||||
{
|
||||
"title": "{{ partial "utils/title" . }}",
|
||||
"link": "{{ .RelPermalink }}",
|
||||
"toc": {{ partial "sidebar/section-page-toc" . }},
|
||||
"open": {{ .Params.sidebar.open | default false }}
|
||||
{{- if .IsSection }},
|
||||
"items": [
|
||||
{{ $pages := union .RegularPages .Sections -}}
|
||||
{{ $pages = where $pages "Params.sidebar.exclude" "!=" true -}}
|
||||
{{ range $index, $page := $pages.ByWeight -}}
|
||||
{{ partial "sidebar/section-walk" . }}{{ if not (ge $index (sub (len $pages) 1)) }},{{ end -}}
|
||||
{{ end -}}
|
||||
]
|
||||
{{ end -}}
|
||||
}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "partials/sidebar/section-page-toc" -}}
|
||||
{{/* Get level 2 headings list used mainly for mobile navigation */}}
|
||||
[
|
||||
{{- with .Fragments.Headings -}}
|
||||
{{/* Loop over level 1 headings */}}
|
||||
{{- range . }}
|
||||
{{- with .Headings }}
|
||||
{{ $headings := . }}
|
||||
{{- range $index, $heading := $headings }}
|
||||
{{ $heading.Title | jsonify (dict "noHTMLEscape" true) }}
|
||||
{{- if not (ge $index (sub (len $headings) 1)) }},{{ end -}}
|
||||
{{ end -}}
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
{{- end -}}
|
||||
]
|
||||
{{- end -}}
|
||||
|
||||
{{ return ($data | jsonify (dict "noHTMLEscape" true)) }}
|
20
layouts/partials/components/sidebar/get-section-data.html
Normal file
20
layouts/partials/components/sidebar/get-section-data.html
Normal file
@ -0,0 +1,20 @@
|
||||
{{/* Get section sidebar config from Hugo `data` directory
|
||||
|
||||
If the site is multilingual, the sidebar data is stored in a language-specific
|
||||
directory. For example, the English sidebar data is stored in `data/en/sidebar.yaml`.
|
||||
*/}}
|
||||
{{ $data := "" }}
|
||||
{{ $section := .Section | default "index" }}
|
||||
{{ $filename := "sidebar" }}
|
||||
|
||||
{{ if hugo.IsMultilingual }}
|
||||
{{ with (index site.Data site.Language.Lang $filename $section) }}
|
||||
{{ $data = . }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ with (index site.Data $filename $section) }}
|
||||
{{ $data = . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ return $data }}
|
18
layouts/partials/components/sidebar/item-link.html
Normal file
18
layouts/partials/components/sidebar/item-link.html
Normal file
@ -0,0 +1,18 @@
|
||||
{{- $external := strings.HasPrefix .link "http" -}}
|
||||
|
||||
{{- $activeClass := cond (.active) "active" "inactive" -}}
|
||||
|
||||
|
||||
<a
|
||||
class="hextra-sidebar-item-link {{ $activeClass }} [-webkit-tap-highlight-color:transparent] [-webkit-touch-callout:none] [word-break:break-word]"
|
||||
href="{{ .link }}"
|
||||
{{ if $external }}target="_blank" rel="noreferer"{{ end }}
|
||||
>
|
||||
{{- .title -}}
|
||||
{{- with .context }}
|
||||
{{- if or .RegularPages .Sections }}
|
||||
{{- partialCached "components/sidebar/collapsible-button" . }}
|
||||
{{- end }}
|
||||
{{ end -}}
|
||||
{{- with .items }}{{- partialCached "components/sidebar/collapsible-button" site.Home }}{{ end -}}
|
||||
</a>
|
16
layouts/partials/components/sidebar/render-data.html
Normal file
16
layouts/partials/components/sidebar/render-data.html
Normal file
@ -0,0 +1,16 @@
|
||||
{{- $page := .page -}}
|
||||
{{- $pageLink := $page.RelPermalink -}}
|
||||
{{- $cached := .cached | default false }}
|
||||
|
||||
{{- range .data -}}
|
||||
{{- $active := and (not $cached) (or (eq $pageLink .link) (eq (strings.TrimSuffix "/" $pageLink) .link)) -}}
|
||||
{{- $containsPage := hasPrefix $pageLink .link -}}
|
||||
{{- $shouldOpen := or (.open) $containsPage $active | default false -}}
|
||||
|
||||
<li class="hextra-sidebar-item {{ if $shouldOpen }}open{{ end }}">
|
||||
{{- partial "components/sidebar/item-link" (dict "active" $active "title" .title "link" .link "items" .items) -}}
|
||||
{{- if .items -}}
|
||||
{{- partial "components/sidebar/render-items" (dict "items" .items "link" $pageLink "cached" $cached) -}}
|
||||
{{- end -}}
|
||||
</li>
|
||||
{{ end }}
|
21
layouts/partials/components/sidebar/render-items.html
Normal file
21
layouts/partials/components/sidebar/render-items.html
Normal file
@ -0,0 +1,21 @@
|
||||
{{- $items := .items -}}
|
||||
{{- $pageLink := .link -}}
|
||||
{{- $cached := .cached | default false }}
|
||||
|
||||
|
||||
<div class="ltr:hx-pr-0 hx-overflow-hidden">
|
||||
<ul class="hextra-sidebar-item-list">
|
||||
{{- range $items }}
|
||||
{{- $active := and (not $cached) (or (eq $pageLink .link) (eq (strings.TrimSuffix "/" $pageLink) .link)) -}}
|
||||
{{- $containsPage := hasPrefix $pageLink .link -}}
|
||||
{{- $shouldOpen := or (.open) $containsPage $active | default false -}}
|
||||
|
||||
<li class="hextra-sidebar-item hx-flex hx-flex-col {{ if $shouldOpen }}open{{ end }}">
|
||||
{{- partial "components/sidebar/item-link" (dict "active" $active "title" .title "link" .link "items" .items) -}}
|
||||
{{- if .items -}}
|
||||
{{- partial "components/sidebar/render-items" (dict "items" .items "link" $pageLink "cached" $cached) -}}
|
||||
{{- end -}}
|
||||
</li>
|
||||
{{- end -}}
|
||||
</ul>
|
||||
</div>
|
@ -1,10 +1,4 @@
|
||||
{{/* site.GoogleAnalytics is deprecated in Hugo v0.120.0 */}}
|
||||
{{/* it will be removed in a future version */}}
|
||||
{{- $gtagID := "" -}}
|
||||
{{- with site.GoogleAnalytics -}}{{ $gtagID = . }}{{- end -}}
|
||||
{{- with site.Config.Services.GoogleAnalytics.ID -}}{{ $gtagID = . }}{{- end -}}
|
||||
|
||||
{{- with $gtagID }}
|
||||
{{- with site.Config.Services.GoogleAnalytics.ID }}
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ . }}"></script>
|
||||
<script>
|
||||
|
@ -30,12 +30,11 @@
|
||||
{{ partialCached "head-css.html" . }}
|
||||
|
||||
|
||||
<!-- Google Analytics -->
|
||||
{{- if and (eq hugo.Environment "production") (or .Site.GoogleAnalytics .Site.Config.Services.GoogleAnalytics.ID) }}
|
||||
<link rel="preconnect" href="https://www.googletagmanager.com" crossorigin />
|
||||
{{ partial "google-analytics.html" . }}
|
||||
{{- end }}
|
||||
|
||||
<!-- Google Analytics -->
|
||||
{{- if and (eq hugo.Environment "production") .Site.Config.Services.GoogleAnalytics.ID }}
|
||||
<link rel="preconnect" href="https://www.googletagmanager.com" crossorigin />
|
||||
{{ partial "google-analytics.html" . }}
|
||||
{{- end }}
|
||||
|
||||
<script>
|
||||
/* Initialize light/dark mode */
|
||||
|
@ -4,7 +4,7 @@
|
||||
{{- $jsLang := resources.Get "js/lang.js" -}}
|
||||
{{- $jsCodeCopy := resources.Get "js/code-copy.js" -}}
|
||||
{{- $jsFileTree := resources.Get "js/filetree.js" -}}
|
||||
{{- $jsSidebar := resources.Get "js/sidebar.js" -}}
|
||||
{{- $jsSidebar := resources.Get "js/sidebar.js" | resources.ExecuteAsTemplate "sidebar.js" . -}}
|
||||
{{- $jsBackToTop := resources.Get "js/back-to-top.js" -}}
|
||||
|
||||
{{- $scripts := slice $jsTheme $jsMenu $jsCodeCopy $jsTabs $jsLang $jsFileTree $jsSidebar $jsBackToTop | resources.Concat "js/main.js" -}}
|
||||
|
95
layouts/partials/sidebar-ng.html
Normal file
95
layouts/partials/sidebar-ng.html
Normal file
@ -0,0 +1,95 @@
|
||||
{{- $context := .context -}}
|
||||
|
||||
{{- $disableSidebar := .disableSidebar | default false -}}
|
||||
{{- $displayPlaceholder := .displayPlaceholder | default false -}}
|
||||
|
||||
{{- $sidebarClass := cond $disableSidebar (cond $displayPlaceholder "md:hx-hidden xl:hx-block" "md:hx-hidden") "md:hx-sticky" -}}
|
||||
|
||||
{{- $navRoot := cond (eq site.Home.Type "docs") site.Home $context.FirstSection -}}
|
||||
{{- $pageURL := $context.RelPermalink -}}
|
||||
|
||||
{{- $data := slice -}}
|
||||
{{- $dataMobile := slice -}}
|
||||
|
||||
{{- if (eq site.Params.page.sidebar.source "data") -}}
|
||||
{{ $data = partialCached "components/sidebar/get-section-data" $context $context.Section }}
|
||||
{{- $dataMobile = $data -}}
|
||||
{{- else -}}
|
||||
{{- $data = (partialCached "components/sidebar/generate-section-data" $navRoot $navRoot) | unmarshal -}}
|
||||
{{- $dataMobile = (partialCached "components/sidebar/generate-section-data" site.Home site.Home) | unmarshal -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $shouldCache := site.Params.page.sidebar.cache | default false -}}
|
||||
|
||||
{{/* EXPERIMENTAL */}}
|
||||
{{- if .context.Params.sidebar.hide -}}
|
||||
{{- $disableSidebar = true -}}
|
||||
{{- $displayPlaceholder = true -}}
|
||||
{{- end -}}
|
||||
|
||||
<div class="mobile-menu-overlay [transition:background-color_1.5s_ease] hx-fixed hx-inset-0 hx-z-10 hx-bg-black/80 dark:hx-bg-black/60 hx-hidden"></div>
|
||||
|
||||
<aside class="hextra-sidebar-container hx-flex hx-flex-col print:hx-hidden md:hx-top-16 md:hx-shrink-0 md:hx-w-64 md:hx-self-start max-md:[transform:translate3d(0,-100%,0)] {{ $sidebarClass }}">
|
||||
{{/* Search bar on small screen */}}
|
||||
{{- partialCached "components/sidebar/mobile-search" . -}}
|
||||
|
||||
|
||||
<div class="hextra-scrollbar hx-overflow-y-auto hx-overflow-x-hidden hx-p-4 hx-grow md:hx-h-[calc(100vh-var(--navbar-height)-var(--menu-height))]">
|
||||
{{/* Mobile Navigation */}}
|
||||
<ul class="hx-flex hx-flex-col hx-gap-1 md:hx-hidden">
|
||||
{{- with $dataMobile -}}
|
||||
{{- partial "components/sidebar/render-data" (dict "data" . "page" $context) -}}
|
||||
{{- end -}}
|
||||
</ul>
|
||||
|
||||
{{/* Sidebar on large screen */}}
|
||||
{{- if $disableSidebar -}}
|
||||
{{- if $displayPlaceholder }}<div class="max-xl:hx-hidden hx-h-0 hx-w-64 hx-shrink-0"></div>{{ end -}}
|
||||
{{ .context.Scratch.Set "enableFooterSwitches" true }}
|
||||
{{- else -}}
|
||||
<ul class="hx-flex hx-flex-col hx-gap-1 max-md:hx-hidden">
|
||||
{{- with $data -}}
|
||||
{{- if $shouldCache -}}
|
||||
{{- partialCached "components/sidebar/render-data" (dict "data" . "page" $context "cached" $shouldCache) $navRoot -}}
|
||||
{{- else -}}
|
||||
{{- partial "components/sidebar/render-data" (dict "data" . "page" $context "cached" $shouldCache) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- partialCached "components/sidebar/bottom" $context site.Home -}}
|
||||
</ul>
|
||||
{{ end -}}
|
||||
</div>
|
||||
{{- partial "components/sidebar/switches" (dict "context" $context "disableSidebar" $disableSidebar) -}}
|
||||
</aside>
|
||||
|
||||
{{- define "partials/components/sidebar/mobile-search" -}}
|
||||
<div class="hx-px-4 hx-pt-4 md:hx-hidden">
|
||||
{{- partialCached "search.html" . -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
{{- define "partials/components/sidebar/switches" -}}
|
||||
{{- $context := .context -}}
|
||||
{{- $disableSidebar := .disableSidebar -}}
|
||||
{{/* Hide theme switch when sidebar is disabled */}}
|
||||
{{ $switchesClass := cond $disableSidebar "md:hx-hidden" "" -}}
|
||||
{{ $displayThemeToggle := (site.Params.theme.displayToggle | default true) -}}
|
||||
|
||||
{{ if or site.IsMultiLingual $displayThemeToggle }}
|
||||
<div
|
||||
class="{{ $switchesClass }} {{ with site.IsMultiLingual }}
|
||||
hx-justify-end
|
||||
{{ end }} hx-sticky hx-bottom-0 hx-bg-white dark:hx-bg-dark hx-mx-4 hx-py-4 hx-shadow-[0_-12px_16px_#fff] hx-flex hx-items-center hx-gap-2 dark:hx-border-neutral-800 dark:hx-shadow-[0_-12px_16px_#111] contrast-more:hx-border-neutral-400 contrast-more:hx-shadow-none contrast-more:dark:hx-shadow-none hx-border-t"
|
||||
data-toggle-animation="show"
|
||||
>
|
||||
{{- with site.IsMultiLingual -}}
|
||||
{{- partial "language-switch" (dict "context" $context "grow" true) -}}
|
||||
{{- with $displayThemeToggle }}{{ partial "theme-toggle" (dict "hideLabel" true) }}{{ end -}}
|
||||
{{- else -}}
|
||||
{{- with $displayThemeToggle -}}
|
||||
<div class="hx-flex hx-grow hx-flex-col">{{ partial "theme-toggle" }}</div>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
@ -4,8 +4,9 @@
|
||||
class="hextra-tabs-panel hx-rounded hx-pt-6 hx-hidden data-[state=selected]:hx-block"
|
||||
id="tabs-panel-{{ .Ordinal }}"
|
||||
role="tabpanel"
|
||||
{{ if eq .Ordinal $defaultIndex }}tabindex="0"{{ end }}
|
||||
{{ if eq .Ordinal $defaultIndex }}data-state="selected"{{ end }}
|
||||
{{- if eq .Ordinal $defaultIndex }} tabindex="0" {{ end -}}
|
||||
{{- if eq .Ordinal $defaultIndex }} data-state="selected" {{ end -}}
|
||||
>
|
||||
{{ .InnerDeindent | markdownify }}
|
||||
{{- .InnerDeindent | markdownify -}}
|
||||
</div>
|
||||
{{- /* Drop trailing newlines */ -}}
|
||||
|
@ -13,9 +13,9 @@
|
||||
role="tab"
|
||||
type="button"
|
||||
aria-controls="tabs-panel-{{ $i }}"
|
||||
{{ if eq $i $defaultIndex }}aria-selected="true"{{ end }}
|
||||
{{ if eq $i $defaultIndex }}tabindex="0"{{ end }}
|
||||
{{ if eq $i $defaultIndex }}data-state="selected"{{ end }}
|
||||
{{- if eq $i $defaultIndex }} aria-selected="true" {{ end -}}
|
||||
{{- if eq $i $defaultIndex }} tabindex="0" {{ end -}}
|
||||
{{- if eq $i $defaultIndex }} data-state="selected"{{ end -}}
|
||||
>
|
||||
{{- $item -}}
|
||||
</button>
|
||||
@ -23,5 +23,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
{{ .Inner }}
|
||||
{{- .Inner -}}
|
||||
</div>
|
||||
{{- /* Drop trailing newlines */ -}}
|
||||
|
@ -7,6 +7,6 @@ command = "cd exampleSite && hugo --gc --minify --themesDir ../.. -b ${DEPLOY_PR
|
||||
ignore = "false"
|
||||
|
||||
[build.environment]
|
||||
HUGO_VERSION = "0.126.1"
|
||||
HUGO_VERSION = "0.132.2"
|
||||
GO_VERSION = "1.22.3"
|
||||
NODE_VERSION = "22.2.0"
|
||||
|
24
package-lock.json
generated
24
package-lock.json
generated
@ -582,9 +582,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/electron-to-chromium": {
|
||||
"version": "1.5.6",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.6.tgz",
|
||||
"integrity": "sha512-jwXWsM5RPf6j9dPYzaorcBSUg6AiqocPEyMpkchkvntaH9HGfOOMZwxMJjDY/XEs3T5dM7uyH1VhRMkqUU9qVw==",
|
||||
"version": "1.5.11",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.11.tgz",
|
||||
"integrity": "sha512-R1CccCDYqndR25CaXFd6hp/u9RaaMcftMkphmvuepXr5b1vfLkRml6aWVeBhXJ7rbevHkKEMJtz8XqPf7ffmew==",
|
||||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
@ -815,9 +815,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/ignore": {
|
||||
"version": "5.3.1",
|
||||
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz",
|
||||
"integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==",
|
||||
"version": "5.3.2",
|
||||
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",
|
||||
"integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
@ -1376,9 +1376,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/postcss-selector-parser": {
|
||||
"version": "6.1.1",
|
||||
"resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.1.tgz",
|
||||
"integrity": "sha512-b4dlw/9V8A71rLIDsSwVmak9z2DuBUB7CA1/wSdelNEzqsjoSPeADTWNO09lpH49Diy3/JIZ2bSPB1dI3LJCHg==",
|
||||
"version": "6.1.2",
|
||||
"resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz",
|
||||
"integrity": "sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@ -1745,9 +1745,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/tailwindcss": {
|
||||
"version": "3.4.9",
|
||||
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.9.tgz",
|
||||
"integrity": "sha512-1SEOvRr6sSdV5IDf9iC+NU4dhwdqzF4zKKq3sAbasUWHEM6lsMhX+eNN5gkPx1BvLFEnZQEUFbXnGj8Qlp83Pg==",
|
||||
"version": "3.4.10",
|
||||
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.10.tgz",
|
||||
"integrity": "sha512-KWZkVPm7yJRhdu4SRSl9d4AK2wM3a50UsvgHZO7xY77NQr2V+fIrEuoDGQcbvswWvFGbS2f6e+jC/6WJm1Dl0w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user