blob: e03b5c07bf16807ae0ff183021d9bcd683907784 (
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
34
35
|
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'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faPlus } from '@fortawesome/free-solid-svg-icons'
/**
* 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)}>
<FontAwesomeIcon icon={faPlus} className="mr-2" />
New Project
</Button>
</div>
<TextInputModal title="New Project" label="Project title" show={isVisible} callback={callback} />
</>
)
}
export default NewProjectContainer
|