Skip to content

Commit

Permalink
Switched to preact + react snowfall for
Browse files Browse the repository at this point in the history
- This is faster
- Smaller bundle
- Code splitting
  • Loading branch information
jakewdr committed Nov 6, 2024
1 parent 4b252e2 commit 90aec97
Show file tree
Hide file tree
Showing 9 changed files with 289 additions and 128 deletions.
4 changes: 4 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import { defineConfig } from "astro/config";
import { visualizer } from "rollup-plugin-visualizer";

import preact from "@astrojs/preact";

// https://astro.build/config

export default defineConfig({
Expand All @@ -14,4 +16,6 @@ export default defineConfig({
},
plugins: [visualizer()],
},

integrations: [preact()],
});
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,20 @@
"format": "yarn biome check --write"
},
"dependencies": {
"astro-particles": "^2.10.0",
"tsparticles-basic": "^2.12.0",
"tsparticles-engine": "^2.12.0"
"@astrojs/preact": "^3.5.3",
"preact": "^10.24.3",
"react-snowfall": "^2.1.1"
},
"devDependencies": {
"@astrojs/check": "^0.9.4",
"@biomejs/biome": "1.9.4",
"astro": "^4.16.8",
"react": "^18.3.1",
"rollup-plugin-visualizer": "^5.12.0",
"typescript": "^5.6.3"
},
"resolutions": {
"react": "npm:@preact/compat@latest",
"react-dom": "npm:@preact/compat@latest"
}
}
45 changes: 0 additions & 45 deletions src/components/Snow.astro

This file was deleted.

17 changes: 17 additions & 0 deletions src/components/Snow.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import Snowfall from "react-snowfall";

const Snow = () => {
return (
<Snowfall
style={{
position: "fixed",
width: "100vw",
height: "100vh",
}}
color="#fff"
snowflakeCount={200}
/>
);
};

export { Snow };
4 changes: 2 additions & 2 deletions src/pages/about.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const pageTitle = "About Me!";
import "../styles/global.css";
import Footer from "../components/Footer.astro";
import Navigation from "../components/Navigation.astro";
import Snow from "../components/Snow.astro";
import { Snow } from "../components/Snow.tsx";
---

<html lang="en">
Expand Down Expand Up @@ -42,6 +42,6 @@ import Snow from "../components/Snow.astro";
<p>I listen to lots of albums in a variety of subgenres</p>
<p>If you want to check up on my full libary go no further then my <a href="https://www.last.fm/user/jwke">LastFM</a></p>
<Footer />
<Snow />
<Snow client:only="preact"/>
</body>
</html>
4 changes: 2 additions & 2 deletions src/pages/blog.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const pageTitle = "Blog";
import "../styles/global.css";
import Footer from "../components/Footer.astro";
import Navigation from "../components/Navigation.astro";
import Snow from "../components/Snow.astro";
import { Snow } from "../components/Snow.tsx";
---
<html lang="en">
<head>
Expand All @@ -20,6 +20,6 @@ import Snow from "../components/Snow.astro";
<li><a href="/posts/template/"><b>[TEMPLATE]</b></a></li>
</ul>
<Footer />
<Snow />
<Snow client:only="preact"/>
</body>
</html>
5 changes: 3 additions & 2 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ const pageTitle = "Home";
import "../styles/global.css";
import Footer from "../components/Footer.astro";
import Navigation from "../components/Navigation.astro";
import Snow from "../components/Snow.astro";
//import Snow from "../components/Snow.astro";
import { Snow } from "../components/Snow.tsx";
---

<html lang="en">
Expand All @@ -19,6 +20,6 @@ import Snow from "../components/Snow.astro";
<h1>{pageTitle}</h1>
<p><i><q>An idiot admires complexity, a genius admires simplicity</q></i> - Terry Davis</p>
<Footer />
<Snow />
<Snow client:only="preact"/>
</body>
</html>
4 changes: 2 additions & 2 deletions src/pages/links.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const pageTitle = "Links";
import "../styles/global.css";
import Footer from "../components/Footer.astro";
import Navigation from "../components/Navigation.astro";
import Snow from "../components/Snow.astro";
import { Snow } from "../components/Snow.tsx";
---

<html lang="en">
Expand All @@ -28,6 +28,6 @@ import Snow from "../components/Snow.astro";
</ul>
</div>
<Footer />
<Snow />
<Snow client:only="preact"/>
</body>
</html>
Loading

0 comments on commit 90aec97

Please sign in to comment.