@@ -12,11 +12,27 @@ interface CalloutWidgetProps {
1212 icon ?: string ;
1313}
1414
15- const backgroundColors = {
16- Info : 'bg-cyan/10 border-cyan/20' ,
17- Success : 'bg-primary/10 border-primary/20' ,
18- Warning : 'bg-yellow/10 border-yellow/20' ,
19- Error : 'bg-destructive/10 border-destructive/20' ,
15+ const calloutVariants = {
16+ Info : {
17+ container :
18+ 'border-cyan/20 bg-cyan/5 text-cyan-foreground dark:border-cyan/30 dark:bg-cyan/10' ,
19+ icon : '' ,
20+ } ,
21+ Success : {
22+ container :
23+ 'border-emerald/20 bg-emerald/5 text-emerald-foreground dark:border-emerald/30 dark:bg-emerald/10' ,
24+ icon : 'text-emerald dark:text-emerald-light' ,
25+ } ,
26+ Warning : {
27+ container :
28+ 'border-amber/20 bg-amber/5 text-amber-foreground dark:border-amber/30 dark:bg-amber/10' ,
29+ icon : 'text-amber dark:text-amber-light' ,
30+ } ,
31+ Error : {
32+ container :
33+ 'border-destructive/20 bg-destructive/5 text-destructive-foreground dark:border-destructive/30 dark:bg-destructive/10' ,
34+ icon : 'text-destructive dark:text-destructive-light' ,
35+ } ,
2036} ;
2137
2238const defaultIcons = {
@@ -44,23 +60,30 @@ export const CalloutWidget: React.FC<CalloutWidgetProps> = ({
4460 }
4561
4662 const variantKey = variant || 'Info' ;
47- const bgClasses = backgroundColors [ variantKey ] ;
63+ const variantStyles = calloutVariants [ variantKey ] ;
4864
4965 return (
5066 < div
5167 style = { styles }
5268 className = { cn (
53- 'flex items-center p-4 text-large-body rounded-lg border' ,
54- bgClasses ,
55- 'text-foreground'
69+ 'flex items-center p-4 text-large-body rounded-lg border transition-colors' ,
70+ variantStyles . container
5671 ) }
5772 role = "alert"
5873 >
59- { icon && < Icon size = "30" name = { icon } className = "mr-4 opacity-70" /> }
74+ { icon && (
75+ < Icon
76+ size = "30"
77+ name = { icon }
78+ className = { cn ( 'mr-4 shrink-0' , variantStyles . icon ) }
79+ />
80+ ) }
6081 < span className = "sr-only" > { variant } </ span >
61- < div className = "flex flex-col" >
62- { title && < div className = "font-medium" > { title } </ div > }
63- { children && < div className = "opacity-80" > { children } </ div > }
82+ < div className = "flex flex-col min-w-0 flex-1" >
83+ { title && < div className = "font-medium leading-none mb-1" > { title } </ div > }
84+ { children && (
85+ < div className = "text-sm opacity-90 leading-relaxed" > { children } </ div >
86+ ) }
6487 </ div >
6588 </ div >
6689 ) ;
0 commit comments