mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-23 03:27:05 -04:00
feat: migrate frontend app to nextjs app router
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
5b5dabc84e
commit
8602645bea
108 changed files with 893 additions and 1188 deletions
|
@ -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'
|
||||
},
|
||||
[]
|
||||
)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue