Skip to content
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

[chore] Update custom tooltip variants #685

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/custom/CustomTooltip/customTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { RenderMarkdownTooltip } from '../Markdown';
type CustomTooltipProps = {
title: string | React.ReactNode | JSX.Element;
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
children: React.ReactNode;
children?: React.ReactNode;
fontSize?: string;
fontWeight?: number;
variant?: 'standard' | 'small';
variant?: 'info' | 'trivial';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's trivial? Please also document this .

bgColor?: string;
} & Omit<TooltipProps, 'title' | 'onClick'>;

Expand All @@ -20,22 +20,22 @@ function CustomTooltip({
children,
fontSize,
fontWeight = 400,
variant = 'standard',
variant = 'info',
bgColor = CHARCOAL,
...props
}: CustomTooltipProps): JSX.Element {
return (
<Tooltip
leaveDelay={1000}
leaveDelay={variant === 'info' ? 1000 : 0}
componentsProps={{
tooltip: {
sx: {
background: bgColor,
color: WHITE,
fontSize: fontSize || (variant === 'standard' ? '1rem' : '0.75rem'),
fontSize: fontSize || (variant === 'info' ? '1rem' : '0.75rem'),
fontWeight: { fontWeight },
borderRadius: '0.5rem',
padding: variant === 'standard' ? '0.9rem' : '0.5rem 0.75rem'
padding: variant === 'info' ? '0.9rem' : '0.5rem 0.75rem'
}
},
popper: {
Expand All @@ -51,7 +51,7 @@ function CustomTooltip({
onClick={onClick}
{...props}
>
{children}
{children || <span />}
</Tooltip>
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/custom/Modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export const ModalFooter: React.FC<ModalFooterProps> = ({ helpText, children, va
return (
<StyledFooter variant={variant} hasHelpText={!!helpText}>
{helpText && (
<CustomTooltip title={helpText} variant="standard" placement="top">
<CustomTooltip title={helpText} variant="info" placement="top">
<IconButton>
<InfoCircleIcon {...iconMedium} className="InfoCircleIcon" />
</IconButton>
Expand Down
Loading