mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix NotFound view body style
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
import React, { useEffect, useRef } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import { Helmet } from 'react-helmet-async';
|
import { Helmet } from 'react-helmet-async';
|
||||||
import useGeneralStore from '../../hooks/stores/useGeneralStore';
|
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { Container, Header, Logo, Page, Boards, BoardsTitle } from '../styled/views/Home.styled';
|
import { Container, Header, Logo, Page, Boards, BoardsTitle } from '../styled/views/Home.styled';
|
||||||
import packageJson from '../../../package.json'
|
import packageJson from '../../../package.json'
|
||||||
@@ -8,31 +7,28 @@ const {version} = packageJson
|
|||||||
|
|
||||||
|
|
||||||
const NotFound = () => {
|
const NotFound = () => {
|
||||||
const {
|
|
||||||
bodyStyle, setBodyStyle,
|
|
||||||
selectedStyle, setSelectedStyle,
|
|
||||||
} = useGeneralStore(state => state);
|
|
||||||
|
|
||||||
const prevStyle = useRef(selectedStyle);
|
|
||||||
const prevBodyStyle = useRef(bodyStyle);
|
|
||||||
|
|
||||||
// prevent dark mode
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const currentPrevStyle = prevStyle.current;
|
const yotsubaBodyStyle = {
|
||||||
const currentPrevBodyStyle = prevBodyStyle.current;
|
|
||||||
|
|
||||||
setBodyStyle({
|
|
||||||
background: "#ffe url(assets/fade.png) top repeat-x",
|
background: "#ffe url(assets/fade.png) top repeat-x",
|
||||||
color: "maroon",
|
color: "maroon",
|
||||||
fontFamily: "Helvetica, Arial, sans-serif"
|
fontFamily: "Arial, Helvetica, sans-serif"
|
||||||
});
|
};
|
||||||
setSelectedStyle("Yotsuba");
|
const originalBodyStyles = {
|
||||||
|
background: document.body.style.background,
|
||||||
|
color: document.body.style.color,
|
||||||
|
fontFamily: document.body.style.fontFamily
|
||||||
|
};
|
||||||
|
|
||||||
|
for (const [key, value] of Object.entries(yotsubaBodyStyle)) {
|
||||||
|
document.body.style[key] = value;
|
||||||
|
}
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
setSelectedStyle(currentPrevStyle);
|
for (const [key, value] of Object.entries(originalBodyStyles)) {
|
||||||
setBodyStyle(currentPrevBodyStyle);
|
document.body.style[key] = value;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}, [setBodyStyle, setSelectedStyle]);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
Reference in New Issue
Block a user