blob: ac0edae4beae9abdcae578c32ec704a300317b97 (
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
|
import React, { useState } from 'react'
import TextInputModal from '../../components/modals/TextInputModal'
import { Button } from 'reactstrap'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faPlus } from '@fortawesome/free-solid-svg-icons'
import { useMutation } from 'react-query'
/**
* A container for creating a new project.
*/
const NewProjectContainer = () => {
const [isVisible, setVisible] = useState(false)
const { mutate: addProject } = useMutation('addProject')
const callback = (text) => {
if (text) {
addProject({ name: 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
|