import React from 'react'; import { QaheraTone, QaheraIconName } from './types'; import { Icon } from './Icon'; export interface AlertProps extends Omit, 'title'> { tone?: QaheraTone; title?: React.ReactNode; icon?: QaheraIconName; onDismiss?: () => void; } const DEFAULT_TONE_ICONS: Record = { info: 'info', success: 'check', warning: 'alert-circle', danger: 'x-circle', neutral: 'info', }; export const Alert: React.FC = ({ children, tone = 'info', title, icon, onDismiss, className = '', ...props }) => { const iconName = icon || DEFAULT_TONE_ICONS[tone as QaheraTone] || 'info'; const classes = [ 'qhr-alert', `qhr-alert--${tone}`, className, ].filter(Boolean).join(' '); return (
{title &&
{title}
}
{children}
{onDismiss && ( )}
); };