2023-01-19 21:21:54 +00:00
|
|
|
/* eslint-disable no-console */
|
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { Slot, Fill } from '@wordpress/components';
|
2023-03-10 14:58:02 +00:00
|
|
|
import {
|
|
|
|
createOrderedChildren,
|
|
|
|
sortFillsByOrder,
|
|
|
|
} from '@woocommerce/components';
|
2023-01-19 21:21:54 +00:00
|
|
|
|
|
|
|
export const WC_TASKLIST_EXPERIMENTAL_PROGRESS_TITLE_SLOT_NAME =
|
|
|
|
'woocommerce_tasklist_experimental_progress_title_item';
|
|
|
|
|
|
|
|
export const WooTaskListProgressTitleItem: React.FC< {
|
2023-03-10 14:58:02 +00:00
|
|
|
children?: React.ReactNode;
|
2023-01-19 21:21:54 +00:00
|
|
|
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>
|
|
|
|
);
|
|
|
|
};
|