Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/scaleflex/ui
Browse files Browse the repository at this point in the history
  • Loading branch information
wagdy-git committed Sep 11, 2024
2 parents 545a201 + 539702f commit eade89a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 18 deletions.
41 changes: 23 additions & 18 deletions packages/ui/src/core/tooltip-v2/tooltip-v2.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const TooltipV2 = intrinsicComponent<TooltipV2Props, HTMLSpanElement>(
arrow = true,
warning = false,
enableHover = true,
hide = false,
enterDelay = 0,
leaveDelay = 0,
offsetX = 0,
Expand All @@ -26,24 +27,28 @@ const TooltipV2 = intrinsicComponent<TooltipV2Props, HTMLSpanElement>(
...rest
}: TooltipV2Props,
ref
): JSX.Element => (
<Styled.TooltipV2
ref={ref}
placement={position}
content={<Styled.TooltipText>{title}</Styled.TooltipText>}
interactive={enableHover}
arrow={arrow}
delay={[enterDelay, leaveDelay]}
$variant={(warning && Variant.Warning) || (info && Variant.Info) || variant}
$size={size || Size.Sm}
animation="scale"
offset={[offsetX, offsetY]}
appendTo={document.body}
{...rest}
>
{children}
</Styled.TooltipV2>
)
): JSX.Element => {
if (hide) return children;

return (
<Styled.TooltipV2
ref={ref}
placement={position}
content={<Styled.TooltipText>{title}</Styled.TooltipText>}
interactive={enableHover}
arrow={arrow}
delay={[enterDelay, leaveDelay]}
$variant={(warning && Variant.Warning) || (info && Variant.Info) || variant}
$size={size || Size.Sm}
animation="scale"
offset={[offsetX, offsetY]}
appendTo={document.body}
{...rest}
>
{children}
</Styled.TooltipV2>
);
}
);

export default TooltipV2;
1 change: 1 addition & 0 deletions packages/ui/src/core/tooltip-v2/tooltip-v2.props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface TooltipV2Props extends Omit<React.HTMLAttributes<HTMLSpanElemen
enableHover?: boolean;
warning?: boolean;
info?: boolean;
hide?: boolean;
enterDelay?: number;
leaveDelay?: number;
offsetX?: number;
Expand Down
1 change: 1 addition & 0 deletions packages/ui/stories/core/tooltip-v2.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ const defaultArgs = {
arrow: false,
warning: false,
info: false,
hide: false,
enableHover: true,
position: Position.Top,
offsetX: 0,
Expand Down

0 comments on commit eade89a

Please sign in to comment.