import React from 'react';
import { Modal, Button, ListGroup } from "react-bootstrap";
import PropTypes from 'prop-types';
class GasStation extends React.Component {
renderPrices = () => {
const {
selectedGasStation,
} = this.props;
return (
{selectedGasStation.prices ? selectedGasStation.prices.map(price => {
return (
{`${price.type} : ${price.price} € `}
);
}) : (null)}
)
}
render () {
const {
showModal,
hideModal,
selectedGasStation,
} = this.props;
return (
{`${selectedGasStation.address} - ${selectedGasStation.city}`}
{this.renderPrices()}
);
}
}
GasStation.defaultProps = {
selectedGasStation: {
address: null,
city: null,
prices: []
}
};
GasStation.propTypes = {
showModal: PropTypes.bool.isRequired,
hideModal: PropTypes.func.isRequired,
selectedGasStation: PropTypes.shape({
address: PropTypes.string,
city: PropTypes.string,
prices: PropTypes.array
}),
};
export default GasStation;