quintodrome/ui/src/reducers/themeReducer.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
432 B
JavaScript
Raw Normal View History

import { CHANGE_THEME } from '../actions'
2021-04-18 09:51:00 -08:00
import config from '../config'
import themes from '../themes'
const defaultTheme = () => {
return (
Object.keys(themes).find(
(t) => themes[t].themeName === config.defaultTheme,
2021-04-18 09:51:00 -08:00
) || 'DarkTheme'
)
}
export const themeReducer = (
2021-04-18 09:51:00 -08:00
previousState = defaultTheme(),
{ type, payload },
) => {
if (type === CHANGE_THEME) {
return payload
}
return previousState
}