mirror of
https://gitlab.com/MrFry/qmining-page
synced 2025-04-01 20:23:44 +02:00
Snow!
This commit is contained in:
parent
b581969ede
commit
d33d112d7e
4 changed files with 25 additions and 1 deletions
|
@ -1,5 +1,8 @@
|
|||
import React, { useState, useEffect } from 'react'
|
||||
import Link from 'next/link'
|
||||
import dynamic from 'next/dynamic'
|
||||
|
||||
const Snowfall = dynamic(() => import('react-snowfall'), { ssr: false })
|
||||
|
||||
import tabs from '../data/tabs.json'
|
||||
import constants from '../constants.json'
|
||||
|
@ -9,6 +12,7 @@ import constants from '../constants.json'
|
|||
export default function Layout(props) {
|
||||
let href = props.route
|
||||
const [sidebarOpen, setSidebarOpen] = useState(true)
|
||||
const [windowSize, setWindowSize] = useState([100, 200])
|
||||
|
||||
if (href === '/' || href === '') {
|
||||
href = 'index'
|
||||
|
@ -24,10 +28,24 @@ export default function Layout(props) {
|
|||
|
||||
useEffect(() => {
|
||||
closeSideBar()
|
||||
setWindowSize([window.innerWidth, window.innerHeight])
|
||||
window.addEventListener('resize', () => {
|
||||
setWindowSize([window.innerWidth, window.innerHeight])
|
||||
})
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div
|
||||
style={{
|
||||
zIndex: 900,
|
||||
position: 'fixed',
|
||||
width: `${windowSize[0]}px`,
|
||||
height: `${windowSize[1]}px`,
|
||||
}}
|
||||
>
|
||||
<Snowfall snowflakeCount={300} />
|
||||
</div>
|
||||
<div className="sidebar">
|
||||
<div className="headercontainer">
|
||||
<span
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue