refresh theme-one starter blocks and layout
Redesign the master layout and content blocks with responsive styling, accessible navigation, and configurable CTA and quote sections. Add about-me, embedded-code, and FAQ blocks, and update the generated theme assets. Replace Alpine-based locale handling with vanilla JavaScript for locale flags and gallery lightboxes, and remove Alpine and DaisyUI dependencies.
This commit is contained in:
@@ -1,13 +1,34 @@
|
||||
import Alpine from 'alpinejs'
|
||||
import {localeMapper} from "./helpers/localemapper.ts";
|
||||
|
||||
|
||||
const getFlagEmoji = (locale: string)=> {
|
||||
const getFlagEmoji = (locale: string) => {
|
||||
const countryCode = localeMapper(locale)
|
||||
return String.fromCodePoint(...[...countryCode.toUpperCase()].map(x=>0x1f1a5+x.charCodeAt(0)))
|
||||
return String.fromCodePoint(...[...countryCode.toUpperCase()].map(x => 0x1f1a5 + x.charCodeAt(0)))
|
||||
}
|
||||
|
||||
window.plugi = {}
|
||||
window.plugi.getFlagEmoji = getFlagEmoji
|
||||
document.querySelectorAll<HTMLElement>("[data-locale-flag]").forEach((flag) => {
|
||||
const locale = flag.dataset.locale
|
||||
if (locale) {
|
||||
flag.textContent = getFlagEmoji(locale)
|
||||
}
|
||||
})
|
||||
|
||||
Alpine.start()
|
||||
document.querySelectorAll<HTMLElement>("[data-gallery]").forEach((gallery) => {
|
||||
if (gallery.dataset.galleryLightbox !== "true") {
|
||||
return
|
||||
}
|
||||
|
||||
const dialog = gallery.querySelector<HTMLDialogElement>("[data-gallery-dialog]")
|
||||
const lightboxImage = dialog?.querySelector<HTMLImageElement>("[data-gallery-lightbox-image]")
|
||||
if (!dialog || !lightboxImage || typeof dialog.showModal !== "function") {
|
||||
return
|
||||
}
|
||||
|
||||
gallery.querySelectorAll<HTMLAnchorElement>("[data-gallery-trigger]").forEach((trigger) => {
|
||||
trigger.addEventListener("click", (event) => {
|
||||
event.preventDefault()
|
||||
lightboxImage.src = trigger.href
|
||||
lightboxImage.alt = trigger.querySelector("img")?.alt ?? ""
|
||||
dialog.showModal()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
@import "tailwindcss";
|
||||
@plugin "daisyui";
|
||||
|
||||
Reference in New Issue
Block a user