Stian Aune
5 years ago
6 changed files with 93 additions and 3 deletions
-
5webui/src/App.css
-
9webui/src/Components/Group.jsx
-
9webui/src/Components/Groups.jsx
-
41webui/src/Components/Modals/GroupAddModal.jsx
-
13webui/src/Helpers/fetcher.js
-
19webui/src/Helpers/groups.js
@ -0,0 +1,41 @@ |
|||
import React, {useState} from "react"; |
|||
import {Button, Form, FormGroup, Input, Label, Modal, ModalBody, ModalFooter, ModalHeader} from "reactstrap"; |
|||
import {addGroup} from "../../Helpers/groups"; |
|||
|
|||
function GroupAddModal({onClose}) { |
|||
const [name, setName] = useState(""); |
|||
|
|||
return ( |
|||
<Modal isOpen={true}> |
|||
<ModalHeader>Ny gruppe</ModalHeader> |
|||
<ModalBody style={{margin: "0 auto"}}> |
|||
<Form> |
|||
<FormGroup> |
|||
<Label for="text-name"> |
|||
Navn |
|||
</Label> |
|||
<Input type="text" |
|||
id="text-name" |
|||
name="power" |
|||
value={name} |
|||
onChange={e => setName(e.target.value)}/> |
|||
</FormGroup> |
|||
</Form> |
|||
</ModalBody> |
|||
<ModalFooter> |
|||
<Button color="primary" |
|||
onClick={() => { |
|||
addGroup(name); |
|||
onClose(); |
|||
}} |
|||
> |
|||
Lagre |
|||
</Button> |
|||
{" "} |
|||
<Button color="secondary" onClick={onClose}>Avbryt</Button> |
|||
</ModalFooter> |
|||
</Modal> |
|||
); |
|||
} |
|||
|
|||
export default GroupAddModal; |
Write
Preview
Loading…
Cancel
Save
Reference in new issue