diff options
Diffstat (limited to 'app/assets/javascripts/components/reducers/modal.jsx')
-rw-r--r-- | app/assets/javascripts/components/reducers/modal.jsx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/app/assets/javascripts/components/reducers/modal.jsx b/app/assets/javascripts/components/reducers/modal.jsx new file mode 100644 index 000000000..b529b6aa8 --- /dev/null +++ b/app/assets/javascripts/components/reducers/modal.jsx @@ -0,0 +1,21 @@ +import { MEDIA_OPEN, MODAL_CLOSE } from '../actions/modal'; +import Immutable from 'immutable'; + +const initialState = Immutable.Map({ + url: '', + open: false +}); + +export default function modal(state = initialState, action) { + switch(action.type) { + case MEDIA_OPEN: + return state.withMutations(map => { + map.set('url', action.url); + map.set('open', true); + }); + case MODAL_CLOSE: + return state.set('open', false); + default: + return state; + } +}; |