import React, { PropsWithChildren, useMemo } from 'react'; import _ from 'lodash'; import { AlertProps } from './types'; const Alert = ({ dismissible, important, mode = 'info', children, className, style, customIcon, ...props }: AlertProps) => { const classes = [ 'alert', mode && `alert-${mode}`, dismissible && `alert-dismissible`, important && `alert-important`, className ].filter(Boolean).join(' '); const Icon = useMemo(() => { if (customIcon) return customIcon; let icon; switch (mode) { case 'danger': icon = 'ti ti-alert-circle'; break; case 'success': icon = 'ti ti-check'; break; case 'warning': icon = 'ti ti-alert-triangle'; break; case 'info': icon = 'ti ti-info-circle'; } return (