This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ExperimentalOrderLocalPickupPackages slot fill
- Loading branch information
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
packages/checkout/components/order-local-pickup-packages/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |