-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
docs: add popover and tooltip stories
1 parent
de2994e
commit 2b64d7f
Showing
4 changed files
with
170 additions
and
19 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 |
---|---|---|
|
@@ -62,3 +62,5 @@ export { | |
layoutVars, | ||
responsiveStyle, | ||
} from "./foundation"; | ||
|
||
export { As } from "@kobalte/core"; |
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,107 @@ | ||
import type { Meta, StoryObj } from "storybook-solidjs"; | ||
|
||
import { Button, Tooltip } from "@codeui/kit"; | ||
|
||
const placements = [ | ||
"top-start", | ||
"top-end", | ||
"right-start", | ||
"right-end", | ||
"bottom-start", | ||
"bottom-end", | ||
"left-start", | ||
"left-end", | ||
] as const; | ||
|
||
const meta = { | ||
title: "DesignSystem/Tooltip", | ||
component: props => { | ||
return <Tooltip {...props} />; | ||
}, | ||
tags: ["autodocs"], | ||
argTypes: { | ||
placement: { | ||
options: placements, | ||
defaultValue: "top-start", | ||
control: { type: "select" }, | ||
}, | ||
theme: { | ||
options: ["primary", "secondary"], | ||
defaultValue: "primary", | ||
control: { type: "inline-radio" }, | ||
}, | ||
disabled: { | ||
defaultValue: false, | ||
type: "boolean", | ||
}, | ||
}, | ||
} satisfies Meta<typeof Tooltip>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const TooltipStory: Story = { | ||
name: "Primary (default)", | ||
args: { | ||
content: "My tooltip content.", | ||
theme: "primary", | ||
}, | ||
render: props => ( | ||
<Tooltip {...props}> | ||
<Button theme="primary" disabled={props.disabled}> | ||
Hover me | ||
</Button> | ||
</Tooltip> | ||
), | ||
}; | ||
|
||
export const TooltipSecondary: Story = { | ||
name: "Secondary", | ||
args: { | ||
content: "My tooltip content.", | ||
theme: "secondary", | ||
}, | ||
render: props => ( | ||
<Tooltip {...props}> | ||
<Button theme="secondary">Hover me</Button> | ||
</Tooltip> | ||
), | ||
}; | ||
|
||
export const TooltipDisabled: Story = { | ||
name: "Disabled", | ||
args: { | ||
content: "My tooltip content.", | ||
theme: "secondary", | ||
disabled: true, | ||
}, | ||
render: () => ( | ||
<Tooltip content={"My tooltip content."} theme={"secondary"} disabled> | ||
<Button theme="secondary" disabled> | ||
Hover me | ||
</Button> | ||
</Tooltip> | ||
), | ||
}; | ||
|
||
export const CustomJsxComponent: Story = { | ||
name: "Custom component", | ||
args: { | ||
content: "My tooltip content.", | ||
theme: "secondary", | ||
disabled: true, | ||
}, | ||
render: () => ( | ||
<Tooltip | ||
content={ | ||
<Button theme={"primary"} size="xs"> | ||
Custom content | ||
</Button> | ||
} | ||
theme={"secondary"} | ||
> | ||
<Button theme="secondary">Hover me</Button> | ||
</Tooltip> | ||
), | ||
}; |