summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-ui/src/containers/projects/NewProjectContainer.js
diff options
context:
space:
mode:
Diffstat (limited to 'opendc-web/opendc-web-ui/src/containers/projects/NewProjectContainer.js')
-rw-r--r--opendc-web/opendc-web-ui/src/containers/projects/NewProjectContainer.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/opendc-web/opendc-web-ui/src/containers/projects/NewProjectContainer.js b/opendc-web/opendc-web-ui/src/containers/projects/NewProjectContainer.js
new file mode 100644
index 00000000..5a8a2dcf
--- /dev/null
+++ b/opendc-web/opendc-web-ui/src/containers/projects/NewProjectContainer.js
@@ -0,0 +1,33 @@
+import React, { useState } from 'react'
+import { useDispatch } from 'react-redux'
+import { addProject } from '../../actions/projects'
+import TextInputModal from '../../components/modals/TextInputModal'
+import { Button } from 'reactstrap'
+
+/**
+ * A container for creating a new project.
+ */
+const NewProjectContainer = () => {
+ const [isVisible, setVisible] = useState(false)
+ const dispatch = useDispatch()
+ const callback = (text) => {
+ if (text) {
+ dispatch(addProject(text))
+ }
+ setVisible(false)
+ }
+
+ return (
+ <>
+ <div className="bottom-btn-container">
+ <Button color="primary" className="float-right" onClick={() => setVisible(true)}>
+ <span className="fa fa-plus mr-2" />
+ New Project
+ </Button>
+ </div>
+ <TextInputModal title="New Project" label="Project title" show={isVisible} callback={callback} />
+ </>
+ )
+}
+
+export default NewProjectContainer