1
0
Fork 0
mirror of https://github.com/pawelmalak/flame.git synced 2025-08-07 03:35:18 +02:00

Changed how theme is set and stored on client

This commit is contained in:
Paweł Malak 2022-03-23 14:49:35 +01:00
parent e427fbf54c
commit 89bd921875
12 changed files with 92 additions and 191 deletions

View file

@ -3,18 +3,11 @@ import { ActionType } from '../action-types';
import { Theme } from '../../interfaces/Theme';
interface ThemeState {
theme: Theme;
themes: Theme[];
}
const initialState: ThemeState = {
theme: {
name: 'tron',
colors: {
background: '#242B33',
primary: '#EFFBFF',
accent: '#6EE2FF',
},
},
themes: [],
};
export const themeReducer = (
@ -22,8 +15,9 @@ export const themeReducer = (
action: Action
): ThemeState => {
switch (action.type) {
case ActionType.setTheme:
return { theme: action.payload };
case ActionType.fetchThemes: {
return { themes: action.payload };
}
default:
return state;