The main server, and probably only repository in this org.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
743 B

import React, {useState} from "react";
import useGroups from "../Hooks/group";
import Group from "./Group";
import Loading from "./Loading";
import GroupAddModal from "./Modals/GroupAddModal";
import {Button, FormGroup} from "reactstrap";
function Groups() {
const groups = useGroups();
const [addModal, setAddModal] = useState(false);
if (groups === null) {
return <Loading/>;
}
return (
<div>
{groups.map(group => <Group key={group.id} {...group} />)}
<FormGroup className="free-buttons">
<Button color="success" onClick={() => setAddModal(true)} >Ny gruppe</Button>
</FormGroup>
{addModal && <GroupAddModal onClose={() => setAddModal(false)}/>}
</div>
);
}
export default Groups;