1- import _ from 'lodash' ;
21import React from 'react' ;
3- import { useTheme } from '@mui/material/styles' ;
42import { Tooltip , TooltipProps } from '../../base' ;
5- import { WHITE } from '../../theme' ;
3+ import { useTheme } from '../../theme' ;
64import { RenderMarkdownTooltip } from '../Markdown' ;
75
86type CustomTooltipProps = {
@@ -12,9 +10,6 @@ type CustomTooltipProps = {
1210 fontSize ?: string ;
1311 fontWeight ?: number ;
1412 variant ?: 'standard' | 'small' ;
15- bgColor ?: string ;
16- textColor ?: string ;
17- useThemeColors ?: boolean ;
1813 componentsProps ?: TooltipProps [ 'componentsProps' ] ;
1914} & Omit < TooltipProps , 'title' | 'onClick' > ;
2015
@@ -26,55 +21,41 @@ function CustomTooltip({
2621 fontSize,
2722 fontWeight = 400 ,
2823 variant = 'standard' ,
29- bgColor = '#141414' ,
30- textColor = WHITE ,
31- useThemeColors = false ,
3224 componentsProps = { } ,
3325 ...props
3426} : CustomTooltipProps ) : JSX . Element {
3527 const theme = useTheme ( ) ;
36-
37- const tooltipBgColor = useThemeColors
38- ? theme . palette . background . paper
39- : bgColor ;
40-
41- const tooltipTextColor = useThemeColors
42- ? theme . palette . text . primary
43- : textColor ;
28+
4429 return (
4530 < Tooltip
4631 enterTouchDelay = { 0 }
4732 leaveTouchDelay = { 2000 }
48- componentsProps = { _ . merge (
49- {
50- tooltip : {
51- sx : {
52- background : tooltipBgColor ,
53- color : tooltipTextColor ,
54- maxWidth : '600px' ,
55- fontSize : fontSize || ( variant === 'standard' ? '1rem' : '0.75rem' ) ,
56- fontWeight : { fontWeight } ,
57- borderRadius : '0.5rem' ,
58- padding : variant === 'standard' ? '0.9rem' : '0.5rem 0.75rem' ,
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'
62- }
63- } ,
64- popper : {
65- sx : {
66- zIndex : 9999999999 ,
67- opacity : '1'
68- }
69- } ,
70- arrow : {
71- sx : {
72- color : tooltipBgColor
73- }
33+ componentsProps = { {
34+ tooltip : {
35+ sx : {
36+ background : theme . palette . background . paper ,
37+ color : theme . palette . text . primary ,
38+ maxWidth : '600px' ,
39+ fontSize : fontSize || ( variant === 'standard' ? '1rem' : '0.75rem' ) ,
40+ fontWeight : { fontWeight } ,
41+ borderRadius : '0.5rem' ,
42+ padding : variant === 'standard' ? '0.9rem' : '0.5rem 0.75rem' ,
43+ boxShadow : theme . shadows [ 4 ]
44+ }
45+ } ,
46+ popper : {
47+ sx : {
48+ zIndex : 9999999999 ,
49+ opacity : '1'
50+ }
51+ } ,
52+ arrow : {
53+ sx : {
54+ color : theme . palette . background . paper
7455 }
7556 } ,
76- componentsProps
77- ) }
57+ ... componentsProps
58+ } }
7859 title = { typeof title === 'string' ? < RenderMarkdownTooltip content = { title } /> : title }
7960 placement = { placement }
8061 arrow
0 commit comments