({
type = "info",
size = "lg",
className,
children,
...props
}: AlertProps)
| 67 | }; |
| 68 | |
| 69 | function Alert({ |
| 70 | type = "info", |
| 71 | size = "lg", |
| 72 | className, |
| 73 | children, |
| 74 | ...props |
| 75 | }: AlertProps) { |
| 76 | const { Icon, border, text, iconColor } = ALERT_CONFIGS[type]; |
| 77 | |
| 78 | const colorMap = { |
| 79 | info: varWithFallback("info"), |
| 80 | success: varWithFallback("success"), |
| 81 | warning: varWithFallback("warning"), |
| 82 | error: varWithFallback("error"), |
| 83 | }; |
| 84 | |
| 85 | return ( |
| 86 | <div |
| 87 | className={cn( |
| 88 | `flex flex-row items-start border-[0.5px] ${border} border-solid shadow-sm ${alertSizes[size]}`, |
| 89 | className, |
| 90 | )} |
| 91 | style={{ |
| 92 | backgroundColor: `color-mix(in srgb, ${colorMap[type]} 20%, transparent)`, |
| 93 | }} |
| 94 | {...props} |
| 95 | > |
| 96 | <Icon className={`flex-shrink-0 ${iconColor} ${iconSizes[size]}`} /> |
| 97 | <div className="flex flex-1 flex-col"> |
| 98 | <div className={`${spacingSizes[size]} ${text}`}>{children}</div> |
| 99 | </div> |
| 100 | </div> |
| 101 | ); |
| 102 | } |
| 103 | |
| 104 | export default Alert; |
nothing calls this directly
no test coverage detected