/**
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import { useShippingData } from '@woocommerce/base-context/hooks';
import {
__experimentalRadio as Radio,
__experimentalRadioGroup as RadioGroup,
} from 'wordpress-components';
import classnames from 'classnames';
import { Icon, store, shipping } from '@wordpress/icons';
/**
* Internal dependencies
*/
import './style.scss';
import { RatePrice, getLocalPickupPrices, getShippingPrices } from './shared';
import type { minMaxPrices } from './shared';
const LocalPickupSelector = ( {
checked,
rate,
showPrice,
showIcon,
toggleText,
multiple,
}: {
checked: string;
rate: minMaxPrices;
showPrice: boolean;
showIcon: boolean;
toggleText: string;
multiple: boolean;
} ) => {
return (
{ showIcon === true && (
) }
{ toggleText }
{ showPrice === true && (
) }
);
};
const ShippingSelector = ( {
checked,
rate,
showPrice,
showIcon,
toggleText,
}: {
checked: string;
rate: minMaxPrices;
showPrice: boolean;
showIcon: boolean;
toggleText: string;
} ) => {
const Price =
rate.min === undefined ? (
{ __(
'calculated with an address',
'woo-gutenberg-products-block'
) }
) : (
);
return (
{ showIcon === true && (
) }
{ toggleText }
{ showPrice === true && Price }
);
};
const Block = ( {
checked,
onChange,
showPrice,
showIcon,
localPickupText,
shippingText,
}: {
checked: string;
onChange: ( value: string ) => void;
showPrice: boolean;
showIcon: boolean;
localPickupText: string;
shippingText: string;
} ): JSX.Element | null => {
const { shippingRates } = useShippingData();
return (
1 }
showPrice={ showPrice }
showIcon={ showIcon }
toggleText={ localPickupText }
/>
);
};
export default Block;