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

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. import React, {useState} from "react";
  2. import useGroups from "../Hooks/group";
  3. import Group from "./Group";
  4. import Loading from "./Loading";
  5. import GroupAddModal from "./Modals/GroupAddModal";
  6. import {Button, FormGroup} from "reactstrap";
  7. function Groups() {
  8. const groups = useGroups();
  9. const [addModal, setAddModal] = useState(false);
  10. if (groups === null) {
  11. return <Loading/>;
  12. }
  13. return (
  14. <div>
  15. {groups.map(group => <Group key={group.id} {...group} />)}
  16. <FormGroup className="free-buttons">
  17. <Button color="success" onClick={() => setAddModal(true)} >Ny gruppe</Button>
  18. </FormGroup>
  19. {addModal && <GroupAddModal onClose={() => setAddModal(false)}/>}
  20. </div>
  21. );
  22. }
  23. export default Groups;