woocommerce/plugins/woocommerce-admin/client/task-lists/progress-title/utils.tsx

39 lines
909 B
TypeScript
Raw Normal View History

/* eslint-disable no-console */
/**
* External dependencies
*/
import { Slot, Fill } from '@wordpress/components';
/**
* Internal dependencies
*/
import { createOrderedChildren, sortFillsByOrder } from '../../utils';
export const WC_TASKLIST_EXPERIMENTAL_PROGRESS_TITLE_SLOT_NAME =
'woocommerce_tasklist_experimental_progress_title_item';
export const WooTaskListProgressTitleItem: React.FC< {
order?: number;
} > & {
Slot: React.FC< Slot.Props >;
} = ( { children, order = 1 } ) => {
return (
<Fill name={ WC_TASKLIST_EXPERIMENTAL_PROGRESS_TITLE_SLOT_NAME }>
{ ( fillProps: Fill.Props ) => {
return createOrderedChildren( children, order, fillProps );
} }
</Fill>
);
};
WooTaskListProgressTitleItem.Slot = ( { fillProps } ) => {
return (
<Slot
name={ WC_TASKLIST_EXPERIMENTAL_PROGRESS_TITLE_SLOT_NAME }
fillProps={ fillProps }
>
{ sortFillsByOrder }
</Slot>
);
};