2023-01-21 03:05:45 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { useSlot } from '@woocommerce/experimental';
|
2024-05-31 03:49:36 +00:00
|
|
|
import clsx from 'clsx';
|
2023-01-21 03:05:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
import {
|
|
|
|
EXPERIMENTAL_WC_TASK_LIST_COMPLETION_SLOT_NAME,
|
|
|
|
WooTaskListCompletion,
|
|
|
|
WooTaskListCompletionFillProps,
|
|
|
|
} from './utils';
|
|
|
|
|
|
|
|
export const TaskListCompletionSlot = ( {
|
|
|
|
className,
|
|
|
|
fillProps,
|
|
|
|
}: {
|
|
|
|
className?: string;
|
|
|
|
fillProps: WooTaskListCompletionFillProps;
|
|
|
|
} ) => {
|
|
|
|
const slot = useSlot( EXPERIMENTAL_WC_TASK_LIST_COMPLETION_SLOT_NAME );
|
|
|
|
const hasFills = Boolean( slot?.fills?.length );
|
|
|
|
if ( ! hasFills ) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return (
|
|
|
|
<div
|
2024-05-31 03:49:36 +00:00
|
|
|
className={ clsx(
|
2023-01-21 03:05:45 +00:00
|
|
|
'woocommerce-tasklist-completion-slot',
|
|
|
|
className
|
|
|
|
) }
|
|
|
|
>
|
|
|
|
<WooTaskListCompletion.Slot fillProps={ fillProps } />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|