feat: simple theme selector. only works with hardcoded light and dark for now

This commit is contained in:
Deluan
2020-03-31 09:35:44 -04:00
parent 500207f7b8
commit f041503a85
8 changed files with 112 additions and 10 deletions
+9 -1
View File
@@ -1,6 +1,14 @@
import React from 'react'
import { useSelector } from 'react-redux'
import { Layout } from 'react-admin'
import Menu from './Menu'
import AppBar from './AppBar'
import { DarkTheme, LightTheme } from '../themes'
export default (props) => <Layout {...props} menu={Menu} appBar={AppBar} />
export default (props) => {
const theme = useSelector((state) =>
state.theme === 'dark' ? DarkTheme : LightTheme
)
return <Layout {...props} menu={Menu} appBar={AppBar} theme={theme} />
}