Skip to content

Commit

Permalink
add tooltip type test
Browse files Browse the repository at this point in the history
  • Loading branch information
celineung committed Aug 30, 2023
1 parent e29286d commit 4e8ec02
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions test/types/Tooltip.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React from "react";
import { useTooltip } from "../../src/Tooltip";

{
const tooltipOnHover = useTooltip();

<>
<a {...tooltipOnHover.tooltipOwnerProps} className="fr-link" href="#">
Example with hover
</a>
<tooltipOnHover.TooltipComponent>Tooltip content</tooltipOnHover.TooltipComponent>
</>;
}

{
const tooltipOnClick = useTooltip({ trigger: "click" });

<>
{tooltipOnClick.TooltipOwnerButtonComponent}
<tooltipOnClick.TooltipComponent>Tooltip content</tooltipOnClick.TooltipComponent>
</>;
}

{
const tooltipOnClick = useTooltip({ trigger: "click", buttonLabel: "Custom button label" });

<>
{tooltipOnClick.TooltipOwnerButtonComponent}
<tooltipOnClick.TooltipComponent>Tooltip content</tooltipOnClick.TooltipComponent>
</>;
}

{
const tooltipOnClick = useTooltip({ trigger: "click" });

<>
<button {...tooltipOnClick.tooltipOwnerProps}>En savoir plus</button>
<tooltipOnClick.TooltipComponent>Tooltip content</tooltipOnClick.TooltipComponent>
</>;
}

0 comments on commit 4e8ec02

Please sign in to comment.