-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3ec31ec
commit 4e30e24
Showing
2 changed files
with
117 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import React from "react"; | ||
import { StoryObj, Meta } from "@storybook/react"; | ||
import { Tooltip } from "../src/main"; | ||
|
||
const meta: Meta = { | ||
title: "Components/Tooltip", | ||
component: Tooltip, | ||
args: { | ||
as: "a", | ||
tooltipContent: "tooltip content", | ||
tooltipPosition: "top", | ||
children: "Hover over me", | ||
}, | ||
argTypes: { | ||
as: { | ||
description: | ||
'The HTML element or React component to render which can be "a" | "div" | "button".', | ||
control: { | ||
type: "select", | ||
options: ["a", "div", "button"], | ||
}, | ||
defaultValue: "a", | ||
}, | ||
tooltipContent: { | ||
description: "The content to display inside the tooltip.", | ||
}, | ||
tooltipPosition: { | ||
description: "The position of the tooltip relative to the element.", | ||
control: { | ||
type: "select", | ||
options: [ | ||
"auto", | ||
"auto-start", | ||
"auto-end", | ||
"top", | ||
"top-start", | ||
"top-end", | ||
"bottom", | ||
"bottom-start", | ||
"bottom-end", | ||
"right", | ||
"right-start", | ||
"right-end", | ||
"left", | ||
"left-start", | ||
"left-end", | ||
], | ||
defaultValue: "auto", | ||
}, | ||
}, | ||
tooltipContainerClassName: { | ||
description: "The class name for the tooltip container.", | ||
control: false, | ||
}, | ||
variant: { | ||
description: "The variant of the tooltip.", | ||
control: { | ||
type: "select", | ||
options: ["general", "error"], | ||
}, | ||
}, | ||
}, | ||
parameters: { layout: "centered" }, | ||
tags: ["autodocs"], | ||
}; | ||
|
||
export default meta; | ||
|
||
export const Default: StoryObj<typeof Tooltip> = { | ||
name: "Default Tooltip", | ||
args: { | ||
as: "button", | ||
children: "Hover over me", | ||
tooltipContent: "This is a tooltip", | ||
tooltipPosition: "top", | ||
}, | ||
render: (args) => ( | ||
<div | ||
style={{ | ||
width: "900px", | ||
height: "100%", | ||
display: "grid", | ||
placeContent: "center", | ||
}} | ||
> | ||
<Tooltip {...args} /> | ||
</div> | ||
), | ||
}; |