Skip to content

Commit

Permalink
fix: Tooltip delays
Browse files Browse the repository at this point in the history
  • Loading branch information
istarkov committed Sep 25, 2024
1 parent a0bce72 commit 1cc47ee
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
31 changes: 27 additions & 4 deletions packages/design-system/src/components/tooltip.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,37 @@
import { InputErrorsTooltip, TooltipProvider } from "./tooltip";
import {
InputErrorsTooltip,
TooltipProvider,
Tooltip as TooltipDesign,
} from "./tooltip";
import { Button } from "./button";
import { Box } from "./box";
import { InputField } from "./input-field";

export default {
title: "Library/Tooltip",
};

const TooltipStory = () => {
export const TooltipDelay = () => {
return (
<TooltipProvider>
<TooltipDesign content="HELLO" delayDuration={1000}>
<Button>Hover me</Button>
</TooltipDesign>

<InputErrorsTooltip errors={[]} side={"right"}>
<InputField
id="input"
placeholder="Input"
css={{
width: 200,
}}
/>
</InputErrorsTooltip>
</TooltipProvider>
);
};

export const Tooltip = () => {
return (
<TooltipProvider>
<Box>Some content</Box>
Expand Down Expand Up @@ -59,5 +84,3 @@ const TooltipStory = () => {
</TooltipProvider>
);
};

export { TooltipStory as Tooltip };
6 changes: 5 additions & 1 deletion packages/design-system/src/components/tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,11 @@ export const InputErrorsTooltip = ({
collisionBoundary={collisionBoundary as never}
collisionPadding={-8}
hideWhenDetached={true}
content={content ?? " "}
content={
errors !== undefined && errors.length !== 0
? (content ?? " ")
: undefined
}
open={errors !== undefined && errors.length !== 0}
side={side ?? "right"}
css={css}
Expand Down

0 comments on commit 1cc47ee

Please sign in to comment.