digitransit-ui/app/component/RentalVehicle.js
2024-09-10 09:55:22 +03:00

29 lines
804 B
JavaScript

import PropTypes from 'prop-types';
import React from 'react';
import Icon from './Icon';
import {
getRentalNetworkIcon,
getRentalNetworkConfig,
} from '../util/vehicleRentalUtils';
import { rentalVehicleShape } from '../util/shapes';
const RentalVehicle = ({ rentalVehicle }, { config }) => {
const vehicleIcon = getRentalNetworkIcon(
getRentalNetworkConfig(rentalVehicle.rentalNetwork.networkId, config),
);
return (
<div className="scooter-content-container">
<Icon img={vehicleIcon} />
</div>
);
};
RentalVehicle.contextTypes = {
config: PropTypes.shape({
vehicleRental: { networks: PropTypes.arrayOf(PropTypes.string.isRequired) },
}).isRequired,
};
RentalVehicle.propTypes = {
rentalVehicle: rentalVehicleShape.isRequired,
};
export default RentalVehicle;