diff --git a/modules/blox-tailwind/assets/css/components/all.css b/modules/blox-tailwind/assets/css/components/all.css index a66929c7..760b35d8 100644 --- a/modules/blox-tailwind/assets/css/components/all.css +++ b/modules/blox-tailwind/assets/css/components/all.css @@ -6,3 +6,4 @@ @import "steps.css"; @import "cards.css"; @import "math.css"; +@import "author-notes.css"; diff --git a/modules/blox-tailwind/assets/css/components/author-notes.css b/modules/blox-tailwind/assets/css/components/author-notes.css new file mode 100644 index 00000000..2baf86be --- /dev/null +++ b/modules/blox-tailwind/assets/css/components/author-notes.css @@ -0,0 +1,47 @@ +/* Author Notes Tooltip Styles */ + +/* Hide elements with x-cloak until Alpine.js initializes */ +[x-cloak] { + display: none !important; +} + +/* Ensure tooltip appears above other content */ +.author-notes-tooltip { + z-index: 9999; +} + +/* Smooth hover effect for the info icon */ +.author-notes { + @apply inline-flex items-center justify-center; + @apply transition-all duration-200 ease-in-out; +} + +/* Focus styles for accessibility */ +.author-notes:focus { + @apply outline-none ring-2 ring-primary-500 ring-offset-2 rounded-full; +} + +/* Additional responsive styles for mobile */ +@media (max-width: 640px) { + /* On mobile, tooltips should be wider if needed */ + .author-notes-tooltip { + white-space: normal; + max-width: 200px; + } +} + +/* Print styles - show author notes inline when printing */ +@media print { + .author-notes { + display: none; + } + + /* Show author notes as superscript numbers in print */ + .author-notes::after { + display: inline; + content: attr(data-tooltip); + vertical-align: super; + font-size: 0.75em; + margin-left: 0.25em; + } +} diff --git a/modules/blox-tailwind/layouts/_partials/blox/collection.html b/modules/blox-tailwind/layouts/_partials/blox/collection.html index 67e7365f..fb2c1c80 100644 --- a/modules/blox-tailwind/layouts/_partials/blox/collection.html +++ b/modules/blox-tailwind/layouts/_partials/blox/collection.html @@ -79,6 +79,15 @@ {{ $query = first $items_count $query }} {{ end }} +{{/* Check if any items have author_notes to enable Alpine.js */}} +{{ range $query }} + {{ if isset .Params "author_notes" }} + {{ $page.Store.Set "has_alpine" true }} + + {{ break }} + {{ end }} +{{ end }} + {{ $columns := $block.design.columns | default "2" }} {{ if $block.content.title }} diff --git a/modules/blox-tailwind/layouts/_partials/libraries.html b/modules/blox-tailwind/layouts/_partials/libraries.html index 20149704..8d920e3a 100644 --- a/modules/blox-tailwind/layouts/_partials/libraries.html +++ b/modules/blox-tailwind/layouts/_partials/libraries.html @@ -1,5 +1,6 @@ {{/* Load Alpine JS extension? */}} {{ if (.Page.Store.Get "has_alpine") }} + {{ $alpine_js := resources.Get "dist/lib/alpinejs/cdn.min.js" }} {{ $alpine_js = $alpine_js | resources.Fingerprint "sha256" }} diff --git a/modules/blox-tailwind/layouts/_partials/page_metadata_authors.html b/modules/blox-tailwind/layouts/_partials/page_metadata_authors.html index 3d974243..147c3e34 100644 --- a/modules/blox-tailwind/layouts/_partials/page_metadata_authors.html +++ b/modules/blox-tailwind/layouts/_partials/page_metadata_authors.html @@ -16,7 +16,36 @@ {{- if isset $.Params "author_notes" -}} {{- with (index $.Params.author_notes $index) -}} - + + +
+ {{.}} + +
+
{{- end -}} {{- end -}} {{- end -}} diff --git a/modules/blox-tailwind/layouts/list.html b/modules/blox-tailwind/layouts/list.html index b74ee95e..c39b9ed5 100644 --- a/modules/blox-tailwind/layouts/list.html +++ b/modules/blox-tailwind/layouts/list.html @@ -10,6 +10,15 @@ {{ $view := .Params.view | default "card" }} {{ $block := . }} +{{/* Check if any pages have author_notes to enable Alpine.js */}} +{{ range .Pages }} + {{ if isset .Params "author_notes" }} + {{ $.Store.Set "has_alpine" true }} + + {{ break }} + {{ end }} +{{ end }} +
{{ partial "functions/render_view" (dict "fragment" "start" "page" $block "item" . "view" $view) }} diff --git a/modules/blox-tailwind/layouts/single.html b/modules/blox-tailwind/layouts/single.html index f148e2a4..684ca2a0 100644 --- a/modules/blox-tailwind/layouts/single.html +++ b/modules/blox-tailwind/layouts/single.html @@ -32,6 +32,12 @@ {{- if .Params.authors }}·{{ end -}} {{- end -}} + {{/* Set Alpine.js flag if author notes exist */}} + {{ if isset .Params "author_notes" }} + {{ .Store.Set "has_alpine" true }} + + {{ end }} + {{ $taxonomy := "authors" }} {{ range $i, $author_obj := (.GetTerms $taxonomy) }} {{ $author_page := $author_obj.Page }} @@ -50,6 +56,41 @@ {{ with $author_page.Params.website }} {{ end }} + {{/* Add author note tooltip if available */}} + {{- if isset $.Params "author_notes" -}} + {{- with (index $.Params.author_notes $i) -}} + + +
+ {{.}} + +
+
+ {{- end -}} + {{- end -}} {{ end }} {{ if ne .Params.reading_time false }}