| 23 | }; |
| 24 | |
| 25 | function Info({ |
| 26 | className, |
| 27 | variant = "default", |
| 28 | children, |
| 29 | ...props |
| 30 | }: React.ComponentProps<"section"> & { |
| 31 | readonly variant?: InfoVariant; |
| 32 | }) { |
| 33 | const Icon = variant === "warning" ? TriangleAlertIcon : InfoIcon; |
| 34 | const variantClass = variantClassName[variant]; |
| 35 | return ( |
| 36 | <section |
| 37 | data-slot="info" |
| 38 | className={cn( |
| 39 | "grid grid-cols-[auto_1fr] gap-x-2.5 gap-y-1 rounded-md border px-3 py-2.5 text-sm", |
| 40 | variant === "warning" ? "border-l-[3px]" : null, |
| 41 | variantClass.root, |
| 42 | className, |
| 43 | )} |
| 44 | {...props} |
| 45 | > |
| 46 | <Icon className={cn("mt-0.5 size-4", variantClass.icon)} aria-hidden /> |
| 47 | <div className="min-w-0 space-y-1.5">{children}</div> |
| 48 | </section> |
| 49 | ); |
| 50 | } |
| 51 | |
| 52 | function InfoTitle({ className, ...props }: React.ComponentProps<"div">) { |
| 53 | return ( |