Display correct weight unit
This commit is contained in:
parent
8173624fca
commit
d5f6f27b2c
3 changed files with 5 additions and 6 deletions
|
@ -105,7 +105,7 @@ const ProductTypeCreatePage: React.FC<ProductTypeCreatePageProps> = ({
|
||||||
<ProductTypeShipping
|
<ProductTypeShipping
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
data={data}
|
data={data}
|
||||||
defaultWeightUnit={defaultWeightUnit}
|
weightUnit={defaultWeightUnit}
|
||||||
onChange={change}
|
onChange={change}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -199,7 +199,7 @@ const ProductTypeDetailsPage: React.FC<ProductTypeDetailsPageProps> = ({
|
||||||
<ProductTypeShipping
|
<ProductTypeShipping
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
data={data}
|
data={data}
|
||||||
defaultWeightUnit={defaultWeightUnit}
|
weightUnit={productType?.weight?.unit || defaultWeightUnit}
|
||||||
onChange={change}
|
onChange={change}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -6,21 +6,20 @@ import { useIntl } from "react-intl";
|
||||||
|
|
||||||
import CardTitle from "@saleor/components/CardTitle";
|
import CardTitle from "@saleor/components/CardTitle";
|
||||||
import { ControlledCheckbox } from "@saleor/components/ControlledCheckbox";
|
import { ControlledCheckbox } from "@saleor/components/ControlledCheckbox";
|
||||||
import { WeightUnitsEnum } from "../../../types/globalTypes";
|
|
||||||
|
|
||||||
interface ProductTypeShippingProps {
|
interface ProductTypeShippingProps {
|
||||||
data: {
|
data: {
|
||||||
isShippingRequired: boolean;
|
isShippingRequired: boolean;
|
||||||
weight: number | null;
|
weight: number | null;
|
||||||
};
|
};
|
||||||
defaultWeightUnit: WeightUnitsEnum;
|
weightUnit: string;
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
onChange: (event: React.ChangeEvent<any>) => void;
|
onChange: (event: React.ChangeEvent<any>) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ProductTypeShipping: React.FC<ProductTypeShippingProps> = ({
|
const ProductTypeShipping: React.FC<ProductTypeShippingProps> = ({
|
||||||
data,
|
data,
|
||||||
defaultWeightUnit,
|
weightUnit,
|
||||||
disabled,
|
disabled,
|
||||||
onChange
|
onChange
|
||||||
}) => {
|
}) => {
|
||||||
|
@ -48,7 +47,7 @@ const ProductTypeShipping: React.FC<ProductTypeShippingProps> = ({
|
||||||
{data.isShippingRequired && (
|
{data.isShippingRequired && (
|
||||||
<TextField
|
<TextField
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
InputProps={{ endAdornment: defaultWeightUnit }}
|
InputProps={{ endAdornment: weightUnit }}
|
||||||
label={intl.formatMessage({
|
label={intl.formatMessage({
|
||||||
defaultMessage: "Weight"
|
defaultMessage: "Weight"
|
||||||
})}
|
})}
|
||||||
|
|
Loading…
Reference in a new issue