woocommerce/plugins/woocommerce-blocks/packages/checkout/components/order-shipping-packages/index.js

51 lines
980 B
JavaScript

/**
* External dependencies
*/
import classnames from 'classnames';
/**
* Internal dependencies
*/
import { createSlotFill, useSlot } from '../../slot';
const slotName = '__experimentalOrderShippingPackages';
const {
Fill: ExperimentalOrderShippingPackages,
Slot: OrderShippingPackagesSlot,
} = createSlotFill( slotName );
const Slot = ( {
className,
collapsible,
noResultsMessage,
renderOption,
extensions,
cart,
components,
} ) => {
const { fills } = useSlot( slotName );
const hasMultiplePackages = fills.length > 1;
return (
<OrderShippingPackagesSlot
className={ classnames(
'wc-block-components-shipping-rates-control',
className
) }
fillProps={ {
collapsible,
collapse: hasMultiplePackages,
showItems: hasMultiplePackages,
noResultsMessage,
renderOption,
extensions,
cart,
components,
} }
/>
);
};
ExperimentalOrderShippingPackages.Slot = Slot;
export default ExperimentalOrderShippingPackages;