feat: migrate frontend app to nextjs app router

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2023-05-29 17:32:44 +02:00
parent 5b5dabc84e
commit 8602645bea
108 changed files with 893 additions and 1188 deletions

View file

@ -1,28 +0,0 @@
/*
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { useDarkModeState } from './use-dark-mode-state'
import { useEffect } from 'react'
/**
* Applies the dark mode by adding a css class to the body tag.
*/
export const useApplyDarkModeStyle = (): void => {
const darkMode = useDarkModeState()
useEffect(() => {
if (darkMode) {
window.document.body.dataset.bsTheme = 'dark'
} else {
window.document.body.dataset.bsTheme = 'light'
}
}, [darkMode])
useEffect(
() => () => {
window.document.body.dataset.bsTheme = 'light'
},
[]
)
}