fix: Fix tooltip control on ButtonPlayground storybook file (fix-ButtonTooltip) (#10937)
Co-authored-by: gitstart-calcom <gitstart@users.noreply.github.com>
This commit is contained in:
co-authored by
gitstart-calcom
parent
e3523db6bb
commit
332c00dac2
@@ -1,3 +1,4 @@
|
||||
import { TooltipProvider } from "@radix-ui/react-tooltip";
|
||||
import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
|
||||
|
||||
import {
|
||||
@@ -17,7 +18,7 @@ import { Button } from "./Button";
|
||||
|
||||
<Meta title="UI/Button" component={Button} />
|
||||
|
||||
<Title title="Buttons" suffix="Brief" subtitle="Version 2.0 — Last Update: 22 Aug 2022" />
|
||||
<Title title="Buttons" suffix="Brief" subtitle="Version 2.1 — Last Update: 24 Aug 2023" />
|
||||
|
||||
## Definition
|
||||
|
||||
@@ -170,6 +171,15 @@ Button are clickable elements that initiates user actions. Labels in the button
|
||||
</Story>
|
||||
<Story
|
||||
name="Button Playground"
|
||||
play={({ canvasElement }) => {
|
||||
const darkVariantContainer = canvasElement.querySelector('[data-mode="dark"]');
|
||||
const buttonElement = darkVariantContainer.querySelector("button");
|
||||
buttonElement?.addEventListener("mouseover", () => {
|
||||
setTimeout(() => {
|
||||
document.querySelector('[data-testid="tooltip"]').classList.add("dark");
|
||||
}, 55);
|
||||
});
|
||||
}}
|
||||
args={{
|
||||
color: "primary",
|
||||
size: "base",
|
||||
@@ -177,6 +187,7 @@ Button are clickable elements that initiates user actions. Labels in the button
|
||||
disabled: false,
|
||||
children: "Button text",
|
||||
className: "",
|
||||
tooltip: "tooltip",
|
||||
}}
|
||||
argTypes={{
|
||||
color: {
|
||||
@@ -212,19 +223,20 @@ Button are clickable elements that initiates user actions. Labels in the button
|
||||
options: ["", "sb-pseudo--hover", "sb-pseudo--focus"],
|
||||
},
|
||||
},
|
||||
tooltip: {
|
||||
control: {
|
||||
type: "text",
|
||||
},
|
||||
},
|
||||
}}>
|
||||
{({ color, size, loading, disabled, children, className }) => (
|
||||
{({ children, ...args }) => (
|
||||
<VariantsTable titles={["Light & Dark Modes"]} columnMinWidth={150}>
|
||||
<VariantRow variant="Button">
|
||||
<Button
|
||||
color={color}
|
||||
size={size}
|
||||
variant="default"
|
||||
loading={loading}
|
||||
disabled={disabled}
|
||||
className={className}>
|
||||
{children}
|
||||
</Button>
|
||||
<TooltipProvider>
|
||||
<Button variant="default" {...args}>
|
||||
{children}
|
||||
</Button>
|
||||
</TooltipProvider>
|
||||
</VariantRow>
|
||||
</VariantsTable>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user