fix(landing-page): js not shipped (#185)
* fix(landing-page): js not shipped * refactor: remove hydration directive
This commit is contained in:
parent
ce1d4df9e8
commit
f86253d66f
4 changed files with 11 additions and 10 deletions
|
@ -2,8 +2,9 @@
|
||||||
import "~/styles/index.css";
|
import "~/styles/index.css";
|
||||||
import Header from "~/components/header.astro";
|
import Header from "~/components/header.astro";
|
||||||
// import Icon from "astro-icon";
|
// import Icon from "astro-icon";
|
||||||
import Splash from "~/sections/splash.astro";
|
import Splash from "~/components/splash.astro";
|
||||||
// import AstroSection from "~/sections/astro-section.astro";
|
// import AstroSection from "~/sections/astro-section.astro";
|
||||||
|
import Starfield from "~/components/starfield.astro";
|
||||||
|
|
||||||
const { site } = Astro;
|
const { site } = Astro;
|
||||||
const image = new URL("social.jpg", site);
|
const image = new URL("social.jpg", site);
|
||||||
|
@ -57,20 +58,19 @@ const description =
|
||||||
if (themeSaved) {
|
if (themeSaved) {
|
||||||
document.documentElement.dataset.theme = themeSaved;
|
document.documentElement.dataset.theme = themeSaved;
|
||||||
} else {
|
} else {
|
||||||
const prefersDark = window.matchMedia(
|
// const prefersDark = window.matchMedia(
|
||||||
"(prefers-color-scheme: dark)"
|
// "(prefers-color-scheme: dark)"
|
||||||
).matches;
|
// ).matches;
|
||||||
document.documentElement.dataset.theme = prefersDark ? "dark" : "light";
|
document.documentElement.dataset.theme = forceTheme; // prefersDark ? "dark" : "light";
|
||||||
}
|
}
|
||||||
|
|
||||||
window
|
window
|
||||||
.matchMedia("(prefers-color-scheme: dark)")
|
.matchMedia("(prefers-color-scheme: dark)")
|
||||||
.addEventListener("change", (event) => {
|
.addEventListener("change", (event) => {
|
||||||
if (!localStorage.getItem("theme")) {
|
if (!localStorage.getItem("theme")) {
|
||||||
document.documentElement.dataset.theme = forceTheme;
|
document.documentElement.dataset.theme = event.matches
|
||||||
// event.matches
|
? "dark"
|
||||||
// ? "dark"
|
: "light";
|
||||||
// : "light";
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -78,8 +78,9 @@ const description =
|
||||||
<body
|
<body
|
||||||
class="h-full overflow-x-hidden text-base bg-default text-default selection:bg-secondary selection:text-white"
|
class="h-full overflow-x-hidden text-base bg-default text-default selection:bg-secondary selection:text-white"
|
||||||
>
|
>
|
||||||
|
<Starfield />
|
||||||
<Header />
|
<Header />
|
||||||
<Splash client:load />
|
<Splash />
|
||||||
<!--AstroSection /-->
|
<!--AstroSection /-->
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue