mirror of
https://github.com/pawelmalak/flame.git
synced 2025-08-07 03:35:18 +02:00
Fixed color of weather icon when changing theme
This commit is contained in:
parent
b8af178cbf
commit
378dd8e36d
5 changed files with 76 additions and 8 deletions
|
@ -1,14 +1,28 @@
|
|||
import { Action } from '../actions';
|
||||
import { ActionType } from '../action-types';
|
||||
import { Theme } from '../../interfaces/Theme';
|
||||
import { arrayPartition } from '../../utility';
|
||||
import { Theme, ThemeColors } from '../../interfaces/Theme';
|
||||
import { arrayPartition, parsePABToTheme } from '../../utility';
|
||||
|
||||
interface ThemeState {
|
||||
activeTheme: Theme;
|
||||
themes: Theme[];
|
||||
userThemes: Theme[];
|
||||
}
|
||||
|
||||
const savedTheme: ThemeColors = parsePABToTheme(localStorage.theme) || {
|
||||
primary: '#effbff',
|
||||
accent: '#6ee2ff',
|
||||
background: '#242b33',
|
||||
};
|
||||
|
||||
const initialState: ThemeState = {
|
||||
activeTheme: {
|
||||
name: 'main',
|
||||
isCustom: false,
|
||||
colors: {
|
||||
...savedTheme,
|
||||
},
|
||||
},
|
||||
themes: [],
|
||||
userThemes: [],
|
||||
};
|
||||
|
@ -18,6 +32,16 @@ export const themeReducer = (
|
|||
action: Action
|
||||
): ThemeState => {
|
||||
switch (action.type) {
|
||||
case ActionType.setTheme: {
|
||||
return {
|
||||
...state,
|
||||
activeTheme: {
|
||||
...state.activeTheme,
|
||||
colors: action.payload,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
case ActionType.fetchThemes: {
|
||||
const [themes, userThemes] = arrayPartition<Theme>(
|
||||
action.payload,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue