about summary refs log tree commit diff
path: root/app/assets/javascripts/components/reducers/modal.jsx
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-10-24 18:07:40 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-10-24 18:08:23 +0200
commitde50eff6acda8b28940cff9b955cfbded3c68b58 (patch)
tree314686b14b18c144de9740c54c2c672dd02d85ed /app/assets/javascripts/components/reducers/modal.jsx
parentf8f40f15dafca65dc07d5c5c19fb9a9dc3473dd6 (diff)
Add opening images in a modal window
Diffstat (limited to 'app/assets/javascripts/components/reducers/modal.jsx')
-rw-r--r--app/assets/javascripts/components/reducers/modal.jsx21
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;
+  }
+};