mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
21 lines
569 B
TypeScript
21 lines
569 B
TypeScript
import { CSSVariableAction, CSSVariableActionTypes } from './css-variable.actions';
|
|
|
|
export interface CSSVariablesState {
|
|
[name: string]: string;
|
|
}
|
|
|
|
const initialState: CSSVariablesState = Object.create({});
|
|
|
|
export function cssVariablesReducer(state = initialState, action: CSSVariableAction): CSSVariablesState {
|
|
switch (action.type) {
|
|
case CSSVariableActionTypes.ADD: {
|
|
const variable = action.payload;
|
|
const t = Object.assign({}, state, { [variable.name]: variable.value });
|
|
return t;
|
|
}
|
|
default: {
|
|
return state;
|
|
}
|
|
}
|
|
}
|