-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
style(Tooltip): changed CustomTooltip font #839
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { Tooltip, type TooltipProps } from '@mui/material'; | ||
import { Tooltip, Typography, styled, type TooltipProps } from '@mui/material'; | ||
import React from 'react'; | ||
import { WHITE } from '../../theme'; | ||
import { SistentThemeProvider, WHITE } from '../../theme'; | ||
import { RenderMarkdownTooltip } from '../Markdown'; | ||
|
||
type CustomTooltipProps = { | ||
|
@@ -13,6 +13,12 @@ type CustomTooltipProps = { | |
bgColor?: string; | ||
} & Omit<TooltipProps, 'title' | 'onClick'>; | ||
|
||
const StyledFontWrapper = styled(Typography)(({ theme }) => ({ | ||
...theme.typography.textH2Medium, | ||
fontSize: '1rem', | ||
lineHeight: '1.5rem' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why specifying here then? |
||
})); | ||
|
||
function CustomTooltip({ | ||
title, | ||
onClick, | ||
|
@@ -25,39 +31,49 @@ function CustomTooltip({ | |
...props | ||
}: CustomTooltipProps): JSX.Element { | ||
return ( | ||
<Tooltip | ||
componentsProps={{ | ||
tooltip: { | ||
sx: { | ||
background: bgColor, | ||
color: WHITE, | ||
fontSize: fontSize || (variant === 'standard' ? '1rem' : '0.75rem'), | ||
fontWeight: { fontWeight }, | ||
borderRadius: '0.5rem', | ||
padding: variant === 'standard' ? '0.9rem' : '0.5rem 0.75rem', | ||
boxShadow: 'rgba(0, 0, 0, 0.6) 0px 4px 10px, rgba(0, 0, 0, 0.5) 0px 2px 4px' | ||
} | ||
}, | ||
popper: { | ||
sx: { | ||
zIndex: 9999999999, | ||
opacity: '1' | ||
} | ||
}, | ||
arrow: { | ||
sx: { | ||
color: bgColor | ||
<SistentThemeProvider> | ||
<Tooltip | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you don't required here to wrap this provider. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we don't wrap this then the theme was not being applied properly and we can't access the correct tokens. |
||
componentsProps={{ | ||
tooltip: { | ||
sx: { | ||
background: bgColor, | ||
color: WHITE, | ||
fontSize: fontSize || (variant === 'standard' ? '1rem' : '0.75rem'), | ||
fontWeight: { fontWeight }, | ||
borderRadius: '0.5rem', | ||
padding: variant === 'standard' ? '0.9rem' : '0.5rem 0.75rem', | ||
boxShadow: 'rgba(0, 0, 0, 0.6) 0px 4px 10px, rgba(0, 0, 0, 0.5) 0px 2px 4px' | ||
} | ||
}, | ||
popper: { | ||
sx: { | ||
zIndex: 9999999999, | ||
opacity: '1' | ||
} | ||
}, | ||
arrow: { | ||
sx: { | ||
color: bgColor | ||
} | ||
} | ||
}} | ||
title={ | ||
typeof title === 'string' ? ( | ||
<StyledFontWrapper> | ||
<RenderMarkdownTooltip content={title} /> | ||
</StyledFontWrapper> | ||
) : ( | ||
title | ||
) | ||
} | ||
}} | ||
title={typeof title === 'string' ? <RenderMarkdownTooltip content={title} /> : title} | ||
placement={placement} | ||
arrow | ||
onClick={onClick} | ||
{...props} | ||
> | ||
{children} | ||
</Tooltip> | ||
placement={placement} | ||
arrow | ||
onClick={onClick} | ||
{...props} | ||
> | ||
{children} | ||
</Tooltip> | ||
</SistentThemeProvider> | ||
); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this variant already has the fontsize in it.