From de50eff6acda8b28940cff9b955cfbded3c68b58 Mon Sep 17 00:00:00 2001
From: Eugen Rochko <eugen@zeonfederated.com>
Date: Mon, 24 Oct 2016 18:07:40 +0200
Subject: Add opening images in a modal window

---
 .../javascripts/components/reducers/modal.jsx       | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 app/assets/javascripts/components/reducers/modal.jsx

(limited to 'app/assets/javascripts/components/reducers/modal.jsx')

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;
+  }
+};
-- 
cgit 

