basic printify integration

This commit is contained in:
James Greenwood
2025-11-30 11:05:49 +00:00
parent dab1ffc91f
commit 39e9744eb7
16 changed files with 1181 additions and 199 deletions

View File

@@ -15,7 +15,8 @@
const setTheme = (theme) => {
if (theme === "system") {
localStorage.removeItem("phx:theme");
document.documentElement.removeAttribute("data-theme");
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
document.documentElement.setAttribute("data-theme", prefersDark ? "dark" : "light");
} else {
localStorage.setItem("phx:theme", theme);
document.documentElement.setAttribute("data-theme", theme);
@@ -25,7 +26,7 @@
setTheme(localStorage.getItem("phx:theme") || "system");
}
window.addEventListener("storage", (e) => e.key === "phx:theme" && setTheme(e.newValue || "system"));
window.addEventListener("phx:set-theme", (e) => setTheme(e.target.dataset.phxTheme));
})();
</script>