blob: a0e607b260899ea4caef15a5a8c7123edfff6690 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
import React, { useState } from 'react'
import { useDispatch } from 'react-redux'
import { addProject } from '../../redux/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
|