| 1 | export const CALLOUT_VARIANTS = { |
| 2 | caution: { |
| 3 | backgroundColor: "#FEF2F2", |
| 4 | icon: "FiXCircle", |
| 5 | textColor: "#991B1B", |
| 6 | textClassName: "text-red-800", |
| 7 | }, |
| 8 | info: { |
| 9 | backgroundColor: "hsl(var(--card))", |
| 10 | icon: "FiInfo", |
| 11 | textColor: "hsl(var(--foreground))", |
| 12 | textClassName: "text-foreground", |
| 13 | }, |
| 14 | note: { |
| 15 | backgroundColor: "hsl(var(--card))", |
| 16 | icon: "FiFileText", |
| 17 | textColor: "hsl(var(--foreground))", |
| 18 | textClassName: "text-foreground", |
| 19 | }, |
| 20 | question: { |
| 21 | backgroundColor: "hsl(var(--card))", |
| 22 | icon: "FiHelpCircle", |
| 23 | textColor: "hsl(var(--foreground))", |
| 24 | textClassName: "text-foreground", |
| 25 | }, |
| 26 | success: { |
| 27 | backgroundColor: "#F0FDF4", |
| 28 | icon: "FiCheckCircle", |
| 29 | textColor: "#065F46", |
| 30 | textClassName: "text-emerald-800", |
| 31 | }, |
| 32 | warning: { |
| 33 | backgroundColor: "#FFF7ED", |
| 34 | icon: "FiAlertTriangle", |
| 35 | textColor: "#92400E", |
| 36 | textClassName: "text-amber-800", |
| 37 | }, |
| 38 | } as const; |
| 39 | |
| 40 | export type CalloutVariant = keyof typeof CALLOUT_VARIANTS; |
| 41 | |
| 42 | const DEFAULT_CALLOUT_VARIANT = "note" satisfies CalloutVariant; |
| 43 | |
| 44 | export function getCalloutVariant(value: unknown): CalloutVariant { |
| 45 | return typeof value === "string" && value in CALLOUT_VARIANTS |
| 46 | ? (value as CalloutVariant) |
| 47 | : DEFAULT_CALLOUT_VARIANT; |
| 48 | } |
| 49 |