From c0ad25715bc050dac0134ccd46f25884396d0f87 Mon Sep 17 00:00:00 2001
From: Matthew Shao <me@matshao.com>
Date: Wed, 28 Jun 2017 18:48:31 +0800
Subject: [web] Add Modal Component and OptionModal

---
 web/src/js/components/Modal/Modal.jsx | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 web/src/js/components/Modal/Modal.jsx

(limited to 'web/src/js/components/Modal/Modal.jsx')

diff --git a/web/src/js/components/Modal/Modal.jsx b/web/src/js/components/Modal/Modal.jsx
new file mode 100644
index 00000000..3370ad36
--- /dev/null
+++ b/web/src/js/components/Modal/Modal.jsx
@@ -0,0 +1,33 @@
+import React, { Component } from 'react'
+import { connect } from 'react-redux'
+import * as modalAction from '../../ducks/ui/modal'
+import ModalList from './ModalList'
+
+class PureModal extends Component {
+
+    constructor(props, context) {
+        super(props, context)
+    }
+
+    render() {
+        const { activeModal, hideModal } = this.props
+        const ActiveModal = _.find(ModalList, m => m.name === activeModal )
+        return(
+            activeModal ?
+                <div>
+                    <div className="modal-backdrop fade in"></div>
+                    <ActiveModal hideModal={ hideModal }/>
+                </div>
+                : <div/>
+        )
+    }
+}
+
+export default connect(
+    state => ({
+        activeModal: state.ui.modal.activeModal
+    }),
+    {
+        hideModal: modalAction.hideModal
+    }
+)(PureModal)
-- 
cgit v1.2.3


From febfeb9ef2bd9c412590c489e12f393f183b9a82 Mon Sep 17 00:00:00 2001
From: Matthew Shao <me@matshao.com>
Date: Wed, 28 Jun 2017 21:48:22 +0800
Subject: [web] Minor update for Modal Component.

---
 web/src/js/components/Modal/Modal.jsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'web/src/js/components/Modal/Modal.jsx')

diff --git a/web/src/js/components/Modal/Modal.jsx b/web/src/js/components/Modal/Modal.jsx
index 3370ad36..e39f5415 100644
--- a/web/src/js/components/Modal/Modal.jsx
+++ b/web/src/js/components/Modal/Modal.jsx
@@ -11,7 +11,7 @@ class PureModal extends Component {
 
     render() {
         const { activeModal, hideModal } = this.props
-        const ActiveModal = _.find(ModalList, m => m.name === activeModal )
+        const ActiveModal = ModalList.find(m => m.name === activeModal )
         return(
             activeModal ?
                 <div>
-- 
cgit v1.2.3


From 7baf3069b169e8196e5d389e655a3a187b4329d9 Mon Sep 17 00:00:00 2001
From: Matthew Shao <me@matshao.com>
Date: Fri, 30 Jun 2017 20:46:02 +0800
Subject: [web] Update the Structure of Modal component.

---
 web/src/js/components/Modal/Modal.jsx | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

(limited to 'web/src/js/components/Modal/Modal.jsx')

diff --git a/web/src/js/components/Modal/Modal.jsx b/web/src/js/components/Modal/Modal.jsx
index e39f5415..88e81156 100644
--- a/web/src/js/components/Modal/Modal.jsx
+++ b/web/src/js/components/Modal/Modal.jsx
@@ -1,6 +1,5 @@
 import React, { Component } from 'react'
 import { connect } from 'react-redux'
-import * as modalAction from '../../ducks/ui/modal'
 import ModalList from './ModalList'
 
 class PureModal extends Component {
@@ -10,15 +9,10 @@ class PureModal extends Component {
     }
 
     render() {
-        const { activeModal, hideModal } = this.props
+        const { activeModal } = this.props
         const ActiveModal = ModalList.find(m => m.name === activeModal )
         return(
-            activeModal ?
-                <div>
-                    <div className="modal-backdrop fade in"></div>
-                    <ActiveModal hideModal={ hideModal }/>
-                </div>
-                : <div/>
+            activeModal ? <ActiveModal/> : <div/>
         )
     }
 }
@@ -26,8 +20,5 @@ class PureModal extends Component {
 export default connect(
     state => ({
         activeModal: state.ui.modal.activeModal
-    }),
-    {
-        hideModal: modalAction.hideModal
-    }
+    })
 )(PureModal)
-- 
cgit v1.2.3

