/**
* External dependencies
*/
import { Slot, Fill } from '@wordpress/components';
/**
* Internal dependencies
*/
import { createOrderedChildren, sortFillsByOrder } from '~/utils';
export const WC_FOOTER_SLOT_NAME = 'woocommerce_footer_item';
/**
* Create a Fill for extensions to add items to the WooCommerce Admin footer.
*
* @slotFill WooFooterItem
* @scope woocommerce-admin
* @example
* const MyFooterItem = () => (
* My header item
* );
*
* registerPlugin( 'my-extension', {
* render: MyFooterItem,
* scope: 'woocommerce-admin',
* } );
* @param {Object} param0
* @param {Array} param0.children - Node children.
* @param {Array} param0.order - Node order.
*/
export const WooFooterItem: React.FC< { order?: number } > & {
Slot: React.FC< Slot.Props >;
} = ( { children, order = 1 } ) => {
return (
{ ( fillProps: Fill.Props ) => {
return createOrderedChildren( children, order, fillProps );
} }
);
};
WooFooterItem.Slot = ( { fillProps } ) => (
{ sortFillsByOrder }
);