feat(ui): when the winter comes
This commit is contained in:
parent
235cab22b7
commit
e0869c5e24
22
islands/Snow.tsx
Normal file
22
islands/Snow.tsx
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
import { IS_BROWSER } from 'fresh/runtime'
|
||||||
|
import { useEffect } from 'preact/hooks'
|
||||||
|
|
||||||
|
let getSnow: () => { clear: () => void } | undefined = () => undefined
|
||||||
|
|
||||||
|
if (IS_BROWSER) {
|
||||||
|
const { LetItGo } = await import('jsr:@eastsun5566/let-it-go')
|
||||||
|
getSnow = () =>
|
||||||
|
new LetItGo({
|
||||||
|
radiusRange: [1, 2],
|
||||||
|
number: globalThis.innerWidth / 4,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function Snow() {
|
||||||
|
useEffect(() => {
|
||||||
|
const snow = getSnow()
|
||||||
|
return () => snow?.clear()
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue