1
0
Fork 0
mirror of https://github.com/pawelmalak/flame.git synced 2025-08-07 11:55:17 +02:00

Functionality to delete and edit custom themes

This commit is contained in:
Paweł Malak 2022-03-25 12:13:19 +01:00
parent ad92de141b
commit 668edb03d3
10 changed files with 157 additions and 12 deletions

View file

@ -1,12 +1,13 @@
import { Action } from '../actions';
import { ActionType } from '../action-types';
import { Theme, ThemeColors } from '../../interfaces/Theme';
import { Theme } from '../../interfaces/Theme';
import { arrayPartition, parsePABToTheme } from '../../utility';
interface ThemeState {
activeTheme: Theme;
themes: Theme[];
userThemes: Theme[];
themeInEdit: Theme | null;
}
const savedTheme = localStorage.theme
@ -23,6 +24,7 @@ const initialState: ThemeState = {
},
themes: [],
userThemes: [],
themeInEdit: null,
};
export const themeReducer = (
@ -60,6 +62,27 @@ export const themeReducer = (
};
}
case ActionType.deleteTheme: {
return {
...state,
userThemes: action.payload,
};
}
case ActionType.editTheme: {
return {
...state,
themeInEdit: action.payload,
};
}
case ActionType.updateTheme: {
return {
...state,
userThemes: action.payload,
};
}
default:
return state;
}