Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | 110x 103x 103x 110x 682x 603x 79x 110x 1400x 367x 367x 203x 203x 830x 10x 820x | // @flow strict
export const mtStylesReducer = (
state: { [string]: string },
action: {| type: string, name: string, value: string |},
) => {
switch (action.type) {
case 'set':
return {
...state,
[action.name]: action.value,
};
default:
throw new Error();
}
};
export const mtAttrsReducer = (
state: { [string]: ?string | ?number | ?boolean },
action: {|
type: string,
name: string,
value?: string | boolean | number,
|},
) => {
switch (action.type) {
case 'set':
return {
...state,
[action.name]: action.value,
};
case 'unset':
return {
...state,
[action.name]: undefined,
};
default:
throw new Error();
}
};
export const mtClassNamesReducer = (
state: Set<string>,
action: {| type: string, className: string |},
) => {
switch (action.type) {
case 'add':
state.add(action.className);
return new Set<string>(state);
case 'remove':
state.delete(action.className);
return new Set<string>(state);
case 'reset':
if (action.className) {
return new Set<string>([action.className]);
}
return new Set<string>();
default:
throw new Error('No reducer type definded');
}
};
|