mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-06-07 09:55:43 -04:00
Replace empty components with hooks (#666)
This commit is contained in:
parent
9e9108ec9a
commit
0d2c2fe0ee
5 changed files with 19 additions and 24 deletions
|
@ -1,20 +0,0 @@
|
|||
import React, { useEffect } from 'react'
|
||||
import { useSelector } from 'react-redux'
|
||||
import { ApplicationState } from '../../../redux'
|
||||
|
||||
export const ApplyDarkMode: React.FC = () => {
|
||||
const darkModeActivated = useSelector((state: ApplicationState) => state.darkMode.darkMode)
|
||||
|
||||
useEffect(() => {
|
||||
if (darkModeActivated) {
|
||||
window.document.body.classList.add('dark')
|
||||
} else {
|
||||
window.document.body.classList.remove('dark')
|
||||
}
|
||||
return () => {
|
||||
window.document.body.classList.remove('dark')
|
||||
}
|
||||
}, [darkModeActivated])
|
||||
|
||||
return null
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue