2022-03-21 13:52:04 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
2023-01-19 21:21:54 +00:00
|
|
|
import { useSlot } from '@woocommerce/experimental';
|
2022-03-21 13:52:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
import './progress-header.scss';
|
2023-01-19 21:21:54 +00:00
|
|
|
import {
|
|
|
|
WC_TASKLIST_EXPERIMENTAL_PROGRESS_HEADER_SLOT_NAME,
|
|
|
|
WooTaskListProgressHeaderItem,
|
|
|
|
} from './utils';
|
|
|
|
import {
|
|
|
|
DefaultProgressHeader,
|
|
|
|
DefaultProgressHeaderProps,
|
|
|
|
} from './default-progress-header';
|
2022-03-21 13:52:04 +00:00
|
|
|
|
2023-01-19 21:21:54 +00:00
|
|
|
export const ProgressHeader: React.FC< DefaultProgressHeaderProps > = ( {
|
2022-03-21 13:52:04 +00:00
|
|
|
taskListId,
|
|
|
|
} ) => {
|
2023-01-19 21:21:54 +00:00
|
|
|
const slot = useSlot( WC_TASKLIST_EXPERIMENTAL_PROGRESS_HEADER_SLOT_NAME );
|
2022-03-21 13:52:04 +00:00
|
|
|
|
2023-01-19 21:21:54 +00:00
|
|
|
return Boolean( slot?.fills?.length ) ? (
|
|
|
|
<WooTaskListProgressHeaderItem.Slot fillProps={ { taskListId } } />
|
|
|
|
) : (
|
|
|
|
<DefaultProgressHeader taskListId={ taskListId } />
|
2022-03-21 13:52:04 +00:00
|
|
|
);
|
|
|
|
};
|