fix(landing-page): js not shipped (#185)

* fix(landing-page): js not shipped

* refactor: remove hydration directive
This commit is contained in:
Ayo Ayco 2022-11-09 22:46:29 +01:00 committed by GitHub
parent ce1d4df9e8
commit f86253d66f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 10 deletions

View file

@ -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>