mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-06 00:07:44 +01:00
2e6b6cd354
https://linear.app/unleash/issue/2-849/dark-mode-ui-fixes ![image](https://user-images.githubusercontent.com/14320932/228607663-fd474e42-b23d-4fc2-a083-d42b87332399.png) ![image](https://user-images.githubusercontent.com/14320932/228607757-bf53d67b-8ef1-4aba-bcc1-f2c6b9cc56a2.png) ![image](https://user-images.githubusercontent.com/14320932/228607875-5bfaeb46-e37c-41d3-941f-bc89e10ad43f.png) Also includes misc UI fixes and improvements we identified along the way. Co-authored by @NicolaeUnleash --------- Co-authored-by: NicolaeUnleash <103567375+NicolaeUnleash@users.noreply.github.com>
56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
TypeScript
import { styled, Tooltip, TooltipProps } from '@mui/material';
|
|
import { HelpOutline } from '@mui/icons-material';
|
|
import { HtmlTooltip } from 'component/common/HtmlTooltip/HtmlTooltip';
|
|
|
|
const StyledContainer = styled('span')(({ theme }) => ({
|
|
display: 'inline-grid',
|
|
alignItems: 'center',
|
|
outline: 0,
|
|
cursor: 'pointer',
|
|
'&:is(:focus-visible, :active) > *, &:hover > *': {
|
|
outlineStyle: 'solid',
|
|
outlineWidth: 2,
|
|
outlineOffset: 0,
|
|
outlineColor: theme.palette.primary.main,
|
|
borderRadius: '100%',
|
|
color: theme.palette.primary.main,
|
|
},
|
|
'& svg': {
|
|
fontSize: theme.fontSizes.mainHeader,
|
|
color: theme.palette.action.active,
|
|
marginLeft: theme.spacing(0.5),
|
|
},
|
|
}));
|
|
|
|
interface IHelpIconProps {
|
|
tooltip: React.ReactNode;
|
|
htmlTooltip?: boolean;
|
|
placement?: TooltipProps['placement'];
|
|
children?: React.ReactNode;
|
|
}
|
|
|
|
export const HelpIcon = ({
|
|
tooltip,
|
|
htmlTooltip,
|
|
placement,
|
|
children,
|
|
}: IHelpIconProps) => {
|
|
if (htmlTooltip) {
|
|
return (
|
|
<HtmlTooltip title={tooltip} placement={placement} arrow>
|
|
<StyledContainer tabIndex={0} aria-label="Help">
|
|
{children ?? <HelpOutline />}
|
|
</StyledContainer>
|
|
</HtmlTooltip>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<Tooltip title={tooltip} placement={placement} arrow>
|
|
<StyledContainer tabIndex={0} aria-label="Help">
|
|
{children ?? <HelpOutline />}
|
|
</StyledContainer>
|
|
</Tooltip>
|
|
);
|
|
};
|