changed from hexo to custom react stuff #1

Merged
developomp merged 73 commits from dev into master 2021-06-27 14:37:56 +09:00
Showing only changes of commit 25e9c10e26 - Show all commits

View file

@ -125,14 +125,15 @@ blockquote {
` `
function App() { function App() {
const [usingTheme, _setTheme] = useState(() => { const [currentTheme, _setTheme] = useState(() => {
const savedTheme = storage.getItem("theme") const savedTheme = storage.getItem("theme")
return savedTheme ? JSON.parse(savedTheme) : { mode: "dark" } return savedTheme ? JSON.parse(savedTheme) : { mode: "dark" }
}) })
// save theme when theme is changed
useEffect(() => { useEffect(() => {
storage.setItem("theme", JSON.stringify(usingTheme)) storage.setItem("theme", JSON.stringify(currentTheme))
}, [usingTheme]) }, [currentTheme])
const [isLoading, setLoading] = useState(true) const [isLoading, setLoading] = useState(true)
@ -154,7 +155,7 @@ function App() {
<HelmetProvider> <HelmetProvider>
<ThemeProvider <ThemeProvider
theme={{ theme={{
...usingTheme, ...currentTheme,
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
setTheme: ({ setTheme, ...theme }) => _setTheme(theme), // make setTheme function available in other components setTheme: ({ setTheme, ...theme }) => _setTheme(theme), // make setTheme function available in other components
}} }}
@ -167,7 +168,7 @@ function App() {
<Spinner <Spinner
size={200} size={200}
color={ color={
usingTheme.mode == "light" currentTheme.mode == "light"
? theming.light.color1 ? theming.light.color1
: theming.dark.color1 : theming.dark.color1
} }