mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-23 00:22:19 +01:00
fix: tooltip arrow regression after last scroll max size feat (#2935)
Fixes an issue where the `HtmlTooltip` arrow would no longer work after a regression included with https://github.com/Unleash/unleash/pull/2891 Also adds the arrow prop to most usages of the tooltip to keep consistency.
This commit is contained in:
parent
aa96d9baf7
commit
08c1123144
@ -1,9 +1,18 @@
|
|||||||
import { styled, Tooltip, tooltipClasses, TooltipProps } from '@mui/material';
|
import { styled, Tooltip, tooltipClasses, TooltipProps } from '@mui/material';
|
||||||
import { SpacingArgument } from '@mui/system/createTheme/createSpacing';
|
import { SpacingArgument } from '@mui/system/createTheme/createSpacing';
|
||||||
|
|
||||||
|
const StyledHtmlTooltipBody = styled('div')(({ theme }) => ({
|
||||||
|
overflow: 'auto',
|
||||||
|
padding: theme.spacing(1, 1.5),
|
||||||
|
}));
|
||||||
|
|
||||||
const StyledHtmlTooltip = styled(
|
const StyledHtmlTooltip = styled(
|
||||||
({ className, maxWidth, maxHeight, ...props }: IHtmlTooltipProps) => (
|
({ className, maxWidth, maxHeight, ...props }: IHtmlTooltipProps) => (
|
||||||
<Tooltip {...props} classes={{ popper: className }} />
|
<Tooltip
|
||||||
|
{...props}
|
||||||
|
title={<StyledHtmlTooltipBody>{props.title}</StyledHtmlTooltipBody>}
|
||||||
|
classes={{ popper: className }}
|
||||||
|
/>
|
||||||
),
|
),
|
||||||
{
|
{
|
||||||
shouldForwardProp: prop => prop !== 'maxWidth' && prop !== 'maxHeight',
|
shouldForwardProp: prop => prop !== 'maxWidth' && prop !== 'maxHeight',
|
||||||
@ -15,7 +24,7 @@ const StyledHtmlTooltip = styled(
|
|||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
backgroundColor: theme.palette.background.paper,
|
backgroundColor: theme.palette.background.paper,
|
||||||
padding: theme.spacing(1, 1.5),
|
padding: 0,
|
||||||
borderRadius: theme.shape.borderRadiusMedium,
|
borderRadius: theme.shape.borderRadiusMedium,
|
||||||
boxShadow: theme.shadows[2],
|
boxShadow: theme.shadows[2],
|
||||||
color: theme.palette.text.primary,
|
color: theme.palette.text.primary,
|
||||||
@ -23,7 +32,6 @@ const StyledHtmlTooltip = styled(
|
|||||||
maxWidth: 'inherit',
|
maxWidth: 'inherit',
|
||||||
border: `1px solid ${theme.palette.lightBorder}`,
|
border: `1px solid ${theme.palette.lightBorder}`,
|
||||||
maxHeight: maxHeight || theme.spacing(37.5),
|
maxHeight: maxHeight || theme.spacing(37.5),
|
||||||
overflow: 'auto',
|
|
||||||
},
|
},
|
||||||
[`& .${tooltipClasses.arrow}`]: {
|
[`& .${tooltipClasses.arrow}`]: {
|
||||||
'&:before': {
|
'&:before': {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { ReactNode } from 'react';
|
import { ReactNode } from 'react';
|
||||||
import { Link, LinkProps, styled, TooltipProps } from '@mui/material';
|
import { Link, LinkProps, styled } from '@mui/material';
|
||||||
import { HtmlTooltip, IHtmlTooltipProps } from '../HtmlTooltip/HtmlTooltip';
|
import { HtmlTooltip, IHtmlTooltipProps } from '../HtmlTooltip/HtmlTooltip';
|
||||||
|
|
||||||
const StyledLink = styled(Link, {
|
const StyledLink = styled(Link, {
|
||||||
@ -26,7 +26,7 @@ export const TooltipLink = ({
|
|||||||
children,
|
children,
|
||||||
...props
|
...props
|
||||||
}: ITooltipLinkProps) => (
|
}: ITooltipLinkProps) => (
|
||||||
<HtmlTooltip title={tooltip} {...tooltipProps}>
|
<HtmlTooltip title={tooltip} {...tooltipProps} arrow>
|
||||||
<StyledLink highlighted={highlighted} {...props}>
|
<StyledLink highlighted={highlighted} {...props}>
|
||||||
{children}
|
{children}
|
||||||
</StyledLink>
|
</StyledLink>
|
||||||
|
@ -46,7 +46,7 @@ export const EnvironmentNameCell = ({
|
|||||||
condition={!environment.enabled}
|
condition={!environment.enabled}
|
||||||
show={
|
show={
|
||||||
<HtmlTooltip
|
<HtmlTooltip
|
||||||
sx={{ maxWidth: '270px' }}
|
maxWidth="270px"
|
||||||
title={
|
title={
|
||||||
<>
|
<>
|
||||||
<StyledTooltipTitle>
|
<StyledTooltipTitle>
|
||||||
@ -60,6 +60,7 @@ export const EnvironmentNameCell = ({
|
|||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
describeChild
|
describeChild
|
||||||
|
arrow
|
||||||
>
|
>
|
||||||
<StyledBadge color="neutral">Deprecated</StyledBadge>
|
<StyledBadge color="neutral">Deprecated</StyledBadge>
|
||||||
</HtmlTooltip>
|
</HtmlTooltip>
|
||||||
|
Loading…
Reference in New Issue
Block a user