1
- import { useTheme } from '@mui/material/styles' ;
2
1
import _ from 'lodash' ;
3
2
import React from 'react' ;
3
+ import { useTheme } from '@mui/material/styles' ;
4
4
import { Tooltip , TooltipProps } from '../../base' ;
5
5
import { WHITE } from '../../theme' ;
6
6
import { RenderMarkdownTooltip } from '../Markdown' ;
@@ -14,7 +14,7 @@ type CustomTooltipProps = {
14
14
variant ?: 'standard' | 'small' ;
15
15
bgColor ?: string ;
16
16
textColor ?: string ;
17
- useThemeColors ?: boolean ; // Add prop to enable theme-based colors
17
+ useThemeColors ?: boolean ;
18
18
componentsProps ?: TooltipProps [ 'componentsProps' ] ;
19
19
} & Omit < TooltipProps , 'title' | 'onClick' > ;
20
20
@@ -28,23 +28,18 @@ function CustomTooltip({
28
28
variant = 'standard' ,
29
29
bgColor = '#141414' ,
30
30
textColor = WHITE ,
31
- useThemeColors = false , // Default to false for backward compatibility
31
+ useThemeColors = false ,
32
32
componentsProps = { } ,
33
33
...props
34
34
} : CustomTooltipProps ) : JSX . Element {
35
35
const theme = useTheme ( ) ;
36
-
37
- // Determine colors based on theme when useThemeColors is true
38
- const tooltipBgColor = useThemeColors
39
- ? theme . palette . mode === 'dark'
40
- ? '#141414'
41
- : '#ffffff'
36
+
37
+ const tooltipBgColor = useThemeColors
38
+ ? theme . palette . background . paper
42
39
: bgColor ;
43
-
40
+
44
41
const tooltipTextColor = useThemeColors
45
- ? theme . palette . mode === 'dark'
46
- ? WHITE
47
- : '#000000'
42
+ ? theme . palette . text . primary
48
43
: textColor ;
49
44
return (
50
45
< Tooltip
@@ -61,10 +56,9 @@ function CustomTooltip({
61
56
fontWeight : { fontWeight } ,
62
57
borderRadius : '0.5rem' ,
63
58
padding : variant === 'standard' ? '0.9rem' : '0.5rem 0.75rem' ,
64
- boxShadow :
65
- useThemeColors && theme . palette . mode === 'light'
66
- ? 'rgba(0, 0, 0, 0.1) 0px 4px 10px, rgba(0, 0, 0, 0.05) 0px 2px 4px'
67
- : 'rgba(0, 0, 0, 0.6) 0px 4px 10px, rgba(0, 0, 0, 0.5) 0px 2px 4px'
59
+ boxShadow : useThemeColors
60
+ ? theme . shadows [ 4 ]
61
+ : 'rgba(0, 0, 0, 0.6) 0px 4px 10px, rgba(0, 0, 0, 0.5) 0px 2px 4px'
68
62
}
69
63
} ,
70
64
popper : {
0 commit comments