mirror of
https://gitlab.com/MrFry/qmining-page
synced 2025-04-01 20:23:44 +02:00
Snow rendering changes, allquestions page fixes and improvements
This commit is contained in:
parent
d15e79e6ac
commit
5a1bd258bc
3 changed files with 34 additions and 28 deletions
|
@ -8,7 +8,11 @@ import tabs from '../data/tabs.json'
|
|||
import constants from '../constants.json'
|
||||
import BB from './b.js'
|
||||
|
||||
// FIXME: window resize event listener to show sidebar on resize
|
||||
const renderSnow = () => {
|
||||
const date = new Date()
|
||||
// if its december, and date is more than 5
|
||||
return date.getMonth() === 11 && date.getDate() > 5
|
||||
}
|
||||
|
||||
export default function Layout(props) {
|
||||
let href = props.route
|
||||
|
@ -29,8 +33,6 @@ export default function Layout(props) {
|
|||
}
|
||||
|
||||
useEffect(() => {
|
||||
closeSideBar()
|
||||
|
||||
fetch(`${constants.apiUrl}infos`, {
|
||||
credentials: 'include',
|
||||
Accept: 'application/json',
|
||||
|
@ -49,23 +51,26 @@ export default function Layout(props) {
|
|||
setWindowSize([window.innerWidth, window.innerHeight])
|
||||
window.addEventListener('resize', () => {
|
||||
setWindowSize([window.innerWidth, window.innerHeight])
|
||||
setSidebarOpen(window.innerWidth >= 700)
|
||||
})
|
||||
}, [])
|
||||
const snowflakeCount = (windowSize[0] + windowSize[1]) / 8
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div
|
||||
style={{
|
||||
pointerEvents: 'none',
|
||||
zIndex: 900,
|
||||
position: 'fixed',
|
||||
width: `${windowSize[0]}px`,
|
||||
height: `${windowSize[1]}px`,
|
||||
}}
|
||||
>
|
||||
<Snowfall snowflakeCount={snowflakeCount} />
|
||||
</div>
|
||||
{renderSnow() && (
|
||||
<div
|
||||
style={{
|
||||
pointerEvents: 'none',
|
||||
zIndex: 900,
|
||||
position: 'fixed',
|
||||
width: `${windowSize[0]}px`,
|
||||
height: `${windowSize[1]}px`,
|
||||
}}
|
||||
>
|
||||
<Snowfall snowflakeCount={snowflakeCount} />
|
||||
</div>
|
||||
)}
|
||||
<div className="sidebar">
|
||||
<div className="headercontainer">
|
||||
<span
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue