2019-08-09 10:26:22 +00:00
|
|
|
import React from "react";
|
2019-08-26 21:54:03 +00:00
|
|
|
import { FormattedMessage } from "react-intl";
|
2019-06-19 14:40:52 +00:00
|
|
|
|
|
|
|
import { Weight } from "../Weight";
|
|
|
|
|
|
|
|
export interface WeightRangeProps {
|
|
|
|
from?: Weight;
|
|
|
|
to?: Weight;
|
|
|
|
}
|
|
|
|
|
2019-08-26 21:54:03 +00:00
|
|
|
const WeightRange: React.FC<WeightRangeProps> = ({ from, to }) =>
|
|
|
|
from && to ? (
|
|
|
|
<FormattedMessage
|
2022-05-05 07:54:28 +00:00
|
|
|
id="5x6yT9"
|
2019-08-26 21:54:03 +00:00
|
|
|
defaultMessage="{fromValue} {fromUnit} - {toValue} {toUnit}"
|
|
|
|
description="weight"
|
|
|
|
values={{
|
2019-06-19 14:40:52 +00:00
|
|
|
fromUnit: from.unit,
|
|
|
|
fromValue: from.value,
|
|
|
|
toUnit: to.unit,
|
2022-06-21 09:36:55 +00:00
|
|
|
toValue: to.value,
|
2019-08-26 21:54:03 +00:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
) : from && !to ? (
|
|
|
|
<FormattedMessage
|
2022-05-05 07:54:28 +00:00
|
|
|
id="LICZeR"
|
2019-08-26 21:54:03 +00:00
|
|
|
defaultMessage="from {value} {unit}"
|
|
|
|
description="weight"
|
|
|
|
values={from}
|
|
|
|
/>
|
|
|
|
) : !from && to ? (
|
|
|
|
<FormattedMessage
|
2022-05-05 07:54:28 +00:00
|
|
|
id="qMB6d2"
|
2019-08-26 21:54:03 +00:00
|
|
|
defaultMessage="to {value} {unit}"
|
|
|
|
description="weight"
|
|
|
|
values={to}
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<span>-</span>
|
|
|
|
);
|
2019-06-19 14:40:52 +00:00
|
|
|
WeightRange.displayName = "WeightRange";
|
|
|
|
export default WeightRange;
|