import {LinkContainer} from 'react-router-bootstrap';
import {Card, Button} from 'react-bootstrap';
import {useHistory, useRouteMatch} from 'react-router-dom';

const Manufacturer = ({name, location, deleteHandler, id}) => {
    const history = useHistory();
    const match = useRouteMatch();

    return (
        <Card className="my-3">
            <Card.Body>
                <Card.Title>{name}</Card.Title>
                <Card.Text>
                    {location}
                </Card.Text>
                <Button variant="primary" className="mx-2" onClick={() => history.push(`${match.path}/form/${id}`)}>Edit</Button>
                <Button variant="danger" className="mx-2" onClick={deleteHandler}>Delete</Button>
            </Card.Body>
        </Card>
    )
};

export default Manufacturer;
