You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
583 B

  1. import Immutable from 'immutable';
  2. import {
  3. DROPDOWN_MENU_OPEN,
  4. DROPDOWN_MENU_CLOSE,
  5. } from '../actions/dropdown_menu';
  6. const initialState = Immutable.Map({ openId: null, placement: null, keyboard: false });
  7. export default function dropdownMenu(state = initialState, action) {
  8. switch (action.type) {
  9. case DROPDOWN_MENU_OPEN:
  10. return state.merge({ openId: action.id, placement: action.placement, keyboard: action.keyboard });
  11. case DROPDOWN_MENU_CLOSE:
  12. return state.get('openId') === action.id ? state.set('openId', null) : state;
  13. default:
  14. return state;
  15. }
  16. }