Skip to content

Commit 4d31901

Browse files
apply suggestion
Signed-off-by: saurabhraghuvanshii <[email protected]>
1 parent 5f4c2a4 commit 4d31901

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

src/custom/CustomTooltip/customTooltip.tsx

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { useTheme } from '@mui/material/styles';
21
import _ from 'lodash';
32
import React from 'react';
3+
import { useTheme } from '@mui/material/styles';
44
import { Tooltip, TooltipProps } from '../../base';
55
import { WHITE } from '../../theme';
66
import { RenderMarkdownTooltip } from '../Markdown';
@@ -14,7 +14,7 @@ type CustomTooltipProps = {
1414
variant?: 'standard' | 'small';
1515
bgColor?: string;
1616
textColor?: string;
17-
useThemeColors?: boolean; // Add prop to enable theme-based colors
17+
useThemeColors?: boolean;
1818
componentsProps?: TooltipProps['componentsProps'];
1919
} & Omit<TooltipProps, 'title' | 'onClick'>;
2020

@@ -28,23 +28,18 @@ function CustomTooltip({
2828
variant = 'standard',
2929
bgColor = '#141414',
3030
textColor = WHITE,
31-
useThemeColors = false, // Default to false for backward compatibility
31+
useThemeColors = false,
3232
componentsProps = {},
3333
...props
3434
}: CustomTooltipProps): JSX.Element {
3535
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
4239
: bgColor;
43-
40+
4441
const tooltipTextColor = useThemeColors
45-
? theme.palette.mode === 'dark'
46-
? WHITE
47-
: '#000000'
42+
? theme.palette.text.primary
4843
: textColor;
4944
return (
5045
<Tooltip
@@ -61,10 +56,9 @@ function CustomTooltip({
6156
fontWeight: { fontWeight },
6257
borderRadius: '0.5rem',
6358
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'
6862
}
6963
},
7064
popper: {

0 commit comments

Comments
 (0)