import * as React from 'react'; import { Flex, FlexItem, Label } from '@patternfly/react-core'; import classNames from 'classnames'; import { WarningIcon } from '~/shared/components/status/icons'; import { formatDaysRemaining, PolicyExceptionKind, type PolicyException, } from './policy-exception-utils'; import './PolicyExceptionList.scss'; const PolicyExceptionRow: React.FC<{ exception: PolicyException }> = ({ exception }) => ( {exception.message} {exception.code} {formatDaysRemaining(exception.daysRemaining)} ); type PolicyExceptionListProps = { exceptions: PolicyException[]; /** Rendered in place of the rows when there is nothing upcoming. */ emptyMessage?: string; className?: string; }; /** * Rows of upcoming policy changes: warning icon, message and rule code on the * left, with the time remaining as a right-aligned compact badge. */ export const PolicyExceptionList: React.FC = ({ exceptions, emptyMessage = 'No expiring exceptions or upcoming activations.', className, }) => { const listClassName = classNames('policy-exception-list', className); if (exceptions.length === 0) { return ( {emptyMessage} ); } return ( {exceptions.map((exception) => ( ))} ); };