import classNames from 'classnames' import type { MouseEventHandler } from 'react' import { ExclamationCircleIcon } from 'lib/icons/ExclamationCircle.js' import { TriangleWarningIcon } from 'lib/icons/TriangleWarning.js' export interface AlertProps { variant: 'warning' | 'error' message: string action?: ActionProps className?: string } interface ActionProps { label: string onClick: MouseEventHandler } export function Alert(props: AlertProps): JSX.Element { const { variant, message, className } = props return (
{variant === 'warning' ? ( ) : ( )}

{message}

{props.action != null && }
) } function Action(props: ActionProps): JSX.Element | null { const handleClick: MouseEventHandler = (event) => { props.onClick(event) } return (
) }