2022-06-04 00:22:36 -07:00
|
|
|
import { Record as ImmutableRecord } from 'immutable';
|
|
|
|
|
|
|
|
import {
|
|
|
|
DROPDOWN_MENU_OPEN,
|
|
|
|
DROPDOWN_MENU_CLOSE,
|
2022-11-16 05:32:32 -08:00
|
|
|
} from '../actions/dropdown-menu';
|
2022-06-04 00:22:36 -07:00
|
|
|
|
|
|
|
import type { AnyAction } from 'redux';
|
|
|
|
|
|
|
|
const ReducerRecord = ImmutableRecord({
|
2023-02-09 09:42:46 -08:00
|
|
|
isOpen: false,
|
2022-06-04 00:22:36 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
type State = ReturnType<typeof ReducerRecord>;
|
|
|
|
|
|
|
|
export default function dropdownMenu(state: State = ReducerRecord(), action: AnyAction) {
|
|
|
|
switch (action.type) {
|
|
|
|
case DROPDOWN_MENU_OPEN:
|
2023-02-09 09:42:46 -08:00
|
|
|
return state.set('isOpen', true);
|
2022-06-04 00:22:36 -07:00
|
|
|
case DROPDOWN_MENU_CLOSE:
|
2023-02-09 09:42:46 -08:00
|
|
|
return state.set('isOpen', false);
|
2022-06-04 00:22:36 -07:00
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
}
|