@@ -21,17 +21,26 @@ pub fn Popover(
21
21
#[ prop( optional) ] trigger_type : PopoverTriggerType ,
22
22
popover_trigger : PopoverTrigger ,
23
23
#[ prop( optional) ] placement : PopoverPlacement ,
24
+ #[ prop( optional) ] tooltip : bool ,
24
25
children : Children ,
25
26
) -> impl IntoView {
26
27
mount_style ( "popover" , include_str ! ( "./popover.css" ) ) ;
27
28
let theme = use_theme ( Theme :: light) ;
28
29
let css_vars = create_memo ( move |_| {
29
30
let mut css_vars = String :: new ( ) ;
30
31
theme. with ( |theme| {
31
- css_vars. push_str ( & format ! (
32
- "--thaw-background-color: {};" ,
33
- theme. time_picker. panel_background_color
34
- ) ) ;
32
+ let background_color = if tooltip {
33
+ & theme. popover . tooltip_background_color
34
+ } else {
35
+ & theme. popover . background_color
36
+ } ;
37
+ css_vars. push_str ( & format ! ( "--thaw-background-color: {};" , background_color) ) ;
38
+ let font_color = if tooltip {
39
+ "#fff"
40
+ } else {
41
+ & theme. common . font_color
42
+ } ;
43
+ css_vars. push_str ( & format ! ( "--thaw-font-color: {};" , font_color) ) ;
35
44
} ) ;
36
45
css_vars
37
46
} ) ;
@@ -129,7 +138,7 @@ pub fn Popover(
129
138
let : display
130
139
>
131
140
<div
132
- class="thaw-popover"
141
+ class=if tooltip { "thaw-popover thaw-popover--tooltip" } else { "thaw-popover" }
133
142
style=move || {
134
143
display. get( ) . map( |d| d. to_string( ) ) . unwrap_or_else( || css_vars. get( ) )
135
144
}
0 commit comments