-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved snow.astro to snow.tsx to allow for deferred loading
- Loading branch information
Showing
11 changed files
with
263 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,18 @@ | ||
// @ts-check | ||
import { defineConfig } from 'astro/config'; | ||
|
||
import react from "@astrojs/react"; | ||
|
||
// https://astro.build/config | ||
|
||
export default defineConfig({ | ||
site: 'https://jakewdr.github.io', | ||
|
||
vite: { | ||
optimizeDeps: { | ||
include: [ | ||
"astro-particles", | ||
"tsparticles-engine", | ||
"tsparticles-basic" | ||
], | ||
exclude: [ | ||
"@astrojs/check", | ||
"@biomejs/biome", | ||
"astro", | ||
"typescript" | ||
] | ||
}, | ||
build: { | ||
cssCodeSplit: true, | ||
minify: "terser", | ||
terserOptions: { | ||
compress: { | ||
unsafe: true, | ||
drop_console: true, | ||
arguments: true | ||
}, | ||
mangle: { | ||
toplevel: true | ||
}, | ||
format: { | ||
quote_style: 1, | ||
} | ||
} | ||
}, | ||
} | ||
cssCodeSplit: true | ||
} | ||
}, | ||
|
||
integrations: [react()] | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { loadBasic } from "@tsparticles/basic"; | ||
import type { Container, ISourceOptions } from "@tsparticles/engine"; | ||
import Particles, { initParticlesEngine } from "@tsparticles/react"; | ||
import { useEffect, useMemo, useState } from "react"; | ||
|
||
const Snow = () => { | ||
const [init, setInit] = useState(false); | ||
|
||
useEffect(() => { | ||
initParticlesEngine(async (engine) => { | ||
await loadBasic(engine); | ||
}).then(() => { | ||
setInit(true); | ||
}); | ||
}, []); | ||
|
||
const particlesLoaded = async (container?: Container): Promise<void> => { | ||
console.log(container); | ||
}; | ||
|
||
const options: ISourceOptions = useMemo( | ||
() => ({ | ||
preset: "snow", | ||
fullScreen: { | ||
zIndex: -1, | ||
}, | ||
particles: { | ||
color: { | ||
value: "#ffffff", | ||
}, | ||
number: { | ||
value: 200, | ||
}, | ||
move: { | ||
enable: true, | ||
}, | ||
opacity: { | ||
value: 0.6, | ||
}, | ||
random: true, | ||
}, | ||
}), | ||
[], | ||
); | ||
|
||
return ( | ||
<Particles | ||
id="tsparticles" | ||
particlesLoaded={particlesLoaded} | ||
options={options} | ||
/> | ||
); | ||
}; | ||
|
||
export default Snow; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
{ | ||
"extends": "astro/tsconfigs/strict" | ||
} | ||
"extends": "astro/tsconfigs/strict", | ||
"compilerOptions": { | ||
"jsx": "react-jsx", | ||
"jsxImportSource": "react" | ||
} | ||
} |
Oops, something went wrong.