You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
703 B
30 lines
703 B
import { Reducer } from 'redux'
|
|
|
|
import { ThemeActions } from '../actions/theme'
|
|
import { ThemeState, ColorScheme } from '../types'
|
|
|
|
const initialState: ThemeState = {
|
|
scheme: ColorScheme.Light,
|
|
name: 'blue',
|
|
}
|
|
|
|
const reducer: Reducer<ThemeState, ThemeActions> = (state = initialState, action) => {
|
|
switch (action.type) {
|
|
case 'THEME_SET_THEME': {
|
|
return {
|
|
...state,
|
|
name: action.payload,
|
|
}
|
|
}
|
|
case 'THEME_SET_COLOR_SCHEME': {
|
|
return {
|
|
...state,
|
|
scheme: action.payload,
|
|
}
|
|
}
|
|
default:
|
|
return state
|
|
}
|
|
}
|
|
|
|
export default reducer
|