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

30 lines
677 B
TypeScript
Raw Normal View History

2022-06-01 17:10:20 +00:00
/**
* External dependencies
*/
import { useSlot } from '@woocommerce/experimental';
2022-06-01 17:10:20 +00:00
/**
* Internal dependencies
*/
import {
WC_TASKLIST_EXPERIMENTAL_PROGRESS_TITLE_SLOT_NAME,
WooTaskListProgressTitleItem,
} from './utils';
import {
DefaultProgressTitle,
DefaultProgressTitleProps,
} from './default-progress-title';
2022-06-01 17:10:20 +00:00
export const ProgressTitle: React.FC< DefaultProgressTitleProps > = ( {
2022-06-01 17:10:20 +00:00
taskListId,
} ) => {
const slot = useSlot( WC_TASKLIST_EXPERIMENTAL_PROGRESS_TITLE_SLOT_NAME );
2022-06-01 17:10:20 +00:00
return Boolean( slot?.fills?.length ) ? (
<WooTaskListProgressTitleItem.Slot fillProps={ { taskListId } } />
) : (
<DefaultProgressTitle taskListId={ taskListId } />
2022-06-01 17:10:20 +00:00
);
};