/** * External dependencies */ import { __ } from '@wordpress/i18n'; import { Icon, check } from '@wordpress/icons'; import { Button } from '@wordpress/components'; import { Text } from '@woocommerce/experimental'; import { __experimentalListItem as ListItem } from '@woocommerce/components'; import classnames from 'classnames'; /** * Internal dependencies */ import './task-item.scss'; import sanitizeHTML from '../lib/sanitize-html'; type TaskItemProps = { title: string; completed: boolean; onClick: () => void; isDismissable?: boolean; onDismiss?: () => void; additionalInfo?: string; time?: string; content?: string; expanded?: boolean; }; export const TaskItem: React.FC< TaskItemProps > = ( { completed, title, isDismissable, onDismiss, onClick, additionalInfo, time, content, expanded = false, } ) => { const className = classnames( 'woocommerce-task-list__item', { 'is-complete': completed, } ); return (
{ completed && }
{ title } { additionalInfo && (
) } { expanded && content && (
{ content }
) } { time && ! completed && (
{ time }
) }
{ onDismiss && isDismissable && ! completed && (
) }
); };