import React, {useState} from "react";
import {Button, FormGroup} from "reactstrap";
import useBridges from "../Hooks/bridge";

function BridgeLight({ id, bridgeId, name }) {
  const [waiting, setWaiting] = useState(false);
  const {forgetLight} = useBridges();

  function forget() {
    setWaiting(true);
    forgetLight(bridgeId, id);
  }

  return (
    <FormGroup>
      <Button color="danger" size="sm" disabled={waiting} onClick={forget}>Glem</Button>
      {" "}
      {name}
    </FormGroup>
  );
}

export default BridgeLight;
