@shopgate/engage
Version:
Shopgate's ENGAGE library.
7 lines • 904 B
JavaScript
import React from'react';import PropTypes from'prop-types';import formatDistance from"../../helpers/formatDistance";import{storeDistance}from"./Store.style";export var UNIT_SYSTEM_METRIC='metric';export var UNIT_SYSTEM_IMPERIAL='imperial';/**
* Renders a single store distance.
* @param {Object} props The component props.
* @param {number} props.distance The distance.
* @param {string} props.unitSystem The unit system.
* @returns {JSX.Element}
*/export function StoreDistance(_ref){var _ref$distance=_ref.distance,distance=_ref$distance===void 0?null:_ref$distance,_ref$unitSystem=_ref.unitSystem,unitSystem=_ref$unitSystem===void 0?UNIT_SYSTEM_METRIC:_ref$unitSystem;if(distance===null){return null;}return React.createElement("span",{className:storeDistance},formatDistance(distance,unitSystem===UNIT_SYSTEM_IMPERIAL));}StoreDistance.defaultProps={distance:null,unitSystem:UNIT_SYSTEM_METRIC};