From b90c2e773713a9e8b8826c72a42ba862c5be4564 Mon Sep 17 00:00:00 2001 From: Xin Date: Wed, 2 Aug 2023 23:14:55 +0100 Subject: [PATCH] feat: add detail box and update styles chore: update 404 page style chore: update icon to use global site variable --- assets/css/typography.css | 12 +++++ content/docs/introduction.md | 2 +- data/icons.yaml | 2 +- layouts/404.html | 44 +++++++++---------- .../_default/_markup/render-codeblock.html | 4 +- layouts/partials/breadcrumb.html | 2 +- layouts/partials/footer.html | 2 +- layouts/partials/pager.html | 4 +- layouts/partials/sidebar.html | 4 +- layouts/partials/utils/icon.html | 2 +- layouts/shortcodes/card.html | 2 +- layouts/shortcodes/details.html | 11 +++++ 12 files changed, 56 insertions(+), 35 deletions(-) create mode 100644 layouts/shortcodes/details.html diff --git a/assets/css/typography.css b/assets/css/typography.css index 00b8b74..61bc3f9 100644 --- a/assets/css/typography.css +++ b/assets/css/typography.css @@ -117,3 +117,15 @@ article.typesetting-article { @apply no-underline hover:no-underline after:hidden; } } + +article details > summary { + &::-webkit-details-marker { + @apply hidden; + } + &::before { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='h-5 w-5' viewBox='0 0 20 20' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z' clip-rule='evenodd' /%3E%3C/svg%3E"); + height: 1.2em; + width: 1.2em; + vertical-align: -4px; + } +} diff --git a/content/docs/introduction.md b/content/docs/introduction.md index cd1c18d..4867e36 100644 --- a/content/docs/introduction.md +++ b/content/docs/introduction.md @@ -3,4 +3,4 @@ title: Introduction weight: 1 --- -Introduction to the project. +Hextra is a modern, responsive Hugo theme built with [Tailwind CSS](https://tailwindcss.com/). diff --git a/data/icons.yaml b/data/icons.yaml index d2323d5..f8c7f87 100644 --- a/data/icons.yaml +++ b/data/icons.yaml @@ -2,7 +2,7 @@ # # Example usage in templates using the icon.html partial: # -# {{ partial "utils/icon.html" (dict "context" . "name" "github" "attributes" "height=24") }} +# {{ partial "utils/icon.html" (dict "name" "github" "attributes" "height=24") }} github: > diff --git a/layouts/404.html b/layouts/404.html index 1a4af0e..0628f45 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -1,29 +1,27 @@ -{{ define "main" }} -
-
- -

404

-
-

This page could not be found.

-
+ } + +

404

+
+

This page could not be found.

-{{ end }} +
diff --git a/layouts/_default/_markup/render-codeblock.html b/layouts/_default/_markup/render-codeblock.html index b0e9b80..49d10f9 100644 --- a/layouts/_default/_markup/render-codeblock.html +++ b/layouts/_default/_markup/render-codeblock.html @@ -16,8 +16,8 @@ {{- end -}}
diff --git a/layouts/partials/breadcrumb.html b/layouts/partials/breadcrumb.html index 8540d7f..3264068 100644 --- a/layouts/partials/breadcrumb.html +++ b/layouts/partials/breadcrumb.html @@ -4,7 +4,7 @@
{{ .LinkTitle }}
- {{ partial "utils/icon.html" (dict "context" . "name" "chevron-right" "attributes" "class=\"w-3.5 shrink-0\"") }} + {{ partial "utils/icon.html" (dict "name" "chevron-right" "attributes" "class=\"w-3.5 shrink-0\"") }} {{ end }} {{ end }}
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index e63c0c6..e33257b 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -5,7 +5,7 @@
Powered by - {{ partial "utils/icon.html" (dict "context" . "name" "hugo-full" "attributes" "height=20") }} + {{ partial "utils/icon.html" (dict "name" "hugo-full" "attributes" "height=20") }}

© 2023 Hextra Project.

diff --git a/layouts/partials/pager.html b/layouts/partials/pager.html index 3771dc3..14d883d 100644 --- a/layouts/partials/pager.html +++ b/layouts/partials/pager.html @@ -6,14 +6,14 @@ diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index b67472c..e425d33 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -55,11 +55,11 @@
diff --git a/layouts/partials/utils/icon.html b/layouts/partials/utils/icon.html index c25b622..0119c24 100644 --- a/layouts/partials/utils/icon.html +++ b/layouts/partials/utils/icon.html @@ -1,4 +1,4 @@ -{{- $icon := index .context.Site.Data.icons .name -}} +{{- $icon := index site.Data.icons .name -}} {{- if not $icon -}} {{ errorf "icon %q not found" .name }} diff --git a/layouts/shortcodes/card.html b/layouts/shortcodes/card.html index 9b4dfef..af67ce3 100644 --- a/layouts/shortcodes/card.html +++ b/layouts/shortcodes/card.html @@ -10,7 +10,7 @@ > {{ with $icon }} - {{ partial "utils/icon.html" (dict "context" $context "name" $icon) }} + {{ partial "utils/icon.html" (dict "name" $icon) }} {{ end }} {{ $title }} diff --git a/layouts/shortcodes/details.html b/layouts/shortcodes/details.html new file mode 100644 index 0000000..da71ae0 --- /dev/null +++ b/layouts/shortcodes/details.html @@ -0,0 +1,11 @@ +{{- $title := .Get "title" | default "" -}} +{{- $closed := eq (.Get "closed") "true" | default false -}} + +
+ + {{ $title | markdownify }} + +
+ {{ .InnerDeindent | markdownify }} +
+