Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Add ExperimentalOrderLocalPickupPackages slot fill
Browse files Browse the repository at this point in the history
  • Loading branch information
opr committed Mar 10, 2023
1 parent ff84f72 commit 31158dc
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/checkout/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export { default as TotalsWrapper } from './totals-wrapper';
export { default as ExperimentalOrderMeta } from './order-meta';
export { default as ExperimentalDiscountsMeta } from './discounts-meta';
export { default as ExperimentalOrderShippingPackages } from './order-shipping-packages';
export { default as ExperimentalOrderLocalPickupPackages } from './order-local-pickup-packages';
export { default as Panel } from './panel';
export { default as Button } from './button';
export { default as Label } from './label';
Expand Down
56 changes: 56 additions & 0 deletions packages/checkout/components/order-local-pickup-packages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/**
* External dependencies
*/
import classnames from 'classnames';
import {
Cart,
CartShippingPackageShippingRate,
} from '@woocommerce/type-defs/cart';
import { Component } from '@wordpress/element';
import { RadioControlOption } from '@woocommerce/base-components/radio-control/types';

/**
* Internal dependencies
*/
import { createSlotFill } from '../../slot';

const slotName = '__experimentalOrderLocalPickupPackages';
const {
Fill: ExperimentalOrderLocalPickupPackages,
Slot: OrderLocalPickupPackagesSlot,
// eslint-disable-next-line @typescript-eslint/naming-convention
} = createSlotFill( slotName );

interface ExperimentalOrderLocalPickupPackagesProps {
extensions: Record< string, unknown >;
cart: Cart;
components: Record< string, Component >;
renderPickupLocation: (
option: CartShippingPackageShippingRate,
packageCount: number
) => RadioControlOption;
}
const Slot = ( {
extensions,
cart,
components,
renderPickupLocation,
}: ExperimentalOrderLocalPickupPackagesProps ) => {
return (
<OrderLocalPickupPackagesSlot
className={ classnames(
'wc-block-components-local-pickup-rates-control'
) }
fillProps={ {
extensions,
cart,
components,
renderPickupLocation,
} }
/>
);
};

ExperimentalOrderLocalPickupPackages.Slot = Slot;

export default ExperimentalOrderLocalPickupPackages;

0 comments on commit 31158dc

Please sign in to comment.