logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

dropdown_menu.js (539B)


  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 });
  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 });
  11. case DROPDOWN_MENU_CLOSE:
  12. return state.get('openId') === action.id ? state.set('openId', null) : state;
  13. default:
  14. return state;
  15. }
  16. }