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.
25 lines
706 B
25 lines
706 B
import React, {useState} from "react";
|
|
import useBridges from "../Hooks/bridge";
|
|
import Bridge from "./Bridge";
|
|
import {Button, FormGroup} from "reactstrap";
|
|
import BridgeModal from "./Modals/BridgeModal";
|
|
|
|
function Bridges() {
|
|
const [modal, setModal] = useState(false);
|
|
const {bridges} = useBridges();
|
|
if (bridges === null) {
|
|
return <></>;
|
|
}
|
|
|
|
return (
|
|
<div>
|
|
{bridges.map(bridge => <Bridge key={bridge.id} {...bridge} />)}
|
|
<FormGroup className="free-buttons">
|
|
<Button color="success" onClick={() => setModal(true)} >Søk etter bru</Button>
|
|
</FormGroup>
|
|
{modal && <BridgeModal onCancel={() => setModal(false)}/> }
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default Bridges;
|