-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(OnyxSystemButton): add tooltip and flyout menu example (#2295)
Relates to #2139 Add Storybook examples for using the OnyxSystemButton with a tooltip and a flyout menu.
- Loading branch information
1 parent
0b46d6f
commit d1cc1d3
Showing
6 changed files
with
85 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"sit-onyx": minor | ||
--- | ||
|
||
feat(OnyxSystemButton): show native browser tooltip when hovering for a few seconds |
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
29 changes: 29 additions & 0 deletions
29
packages/sit-onyx/src/components/OnyxSystemButton/examples/WithFlyoutMenu.stories.ts
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,29 @@ | ||
import type { Meta, StoryObj } from "@storybook/vue3"; | ||
import WithFlyoutMenu from "./WithFlyoutMenu.vue"; | ||
import WithFlyoutMenuSourceCode from "./WithFlyoutMenu.vue?raw"; | ||
|
||
const meta: Meta<typeof WithFlyoutMenu> = { | ||
title: "Buttons/SystemButton/Examples/FlyoutMenu", | ||
component: WithFlyoutMenu, | ||
parameters: { | ||
docs: { | ||
source: { | ||
code: WithFlyoutMenuSourceCode.replace('from "../../.."', 'from "sit-onyx"'), | ||
}, | ||
}, | ||
}, | ||
decorators: [ | ||
(story) => ({ | ||
components: { story }, | ||
template: ` | ||
<div style="height: 16rem;"> | ||
<story /> | ||
</div>`, | ||
}), | ||
], | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof WithFlyoutMenu>; | ||
|
||
export const Default = { args: {} } satisfies Story; |
18 changes: 18 additions & 0 deletions
18
packages/sit-onyx/src/components/OnyxSystemButton/examples/WithFlyoutMenu.vue
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,18 @@ | ||
<script lang="ts" setup> | ||
import moreVertical from "@sit-onyx/icons/more-vertical.svg?raw"; | ||
import { OnyxFlyoutMenu, OnyxMenuItem, OnyxSystemButton } from "../../.."; | ||
</script> | ||
|
||
<template> | ||
<OnyxFlyoutMenu label="Actions"> | ||
<template #button="{ trigger }"> | ||
<OnyxSystemButton v-bind="trigger" label="Toggle actions" :icon="moreVertical" /> | ||
</template> | ||
|
||
<template #options> | ||
<OnyxMenuItem>Action 1</OnyxMenuItem> | ||
<OnyxMenuItem>Action 2</OnyxMenuItem> | ||
<OnyxMenuItem>Action 3</OnyxMenuItem> | ||
</template> | ||
</OnyxFlyoutMenu> | ||
</template> |
20 changes: 20 additions & 0 deletions
20
packages/sit-onyx/src/components/OnyxSystemButton/examples/WithTooltip.stories.ts
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,20 @@ | ||
import type { Meta, StoryObj } from "@storybook/vue3"; | ||
import WithTooltip from "./WithTooltip.vue"; | ||
import WithTooltipSourceCode from "./WithTooltip.vue?raw"; | ||
|
||
const meta: Meta<typeof WithTooltip> = { | ||
title: "Buttons/SystemButton/Examples/Tooltip", | ||
component: WithTooltip, | ||
parameters: { | ||
docs: { | ||
source: { | ||
code: WithTooltipSourceCode.replace('from "../../.."', 'from "sit-onyx"'), | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof WithTooltip>; | ||
|
||
export const Default = { args: {} } satisfies Story; |
12 changes: 12 additions & 0 deletions
12
packages/sit-onyx/src/components/OnyxSystemButton/examples/WithTooltip.vue
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,12 @@ | ||
<script lang="ts" setup> | ||
import moreVertical from "@sit-onyx/icons/more-vertical.svg?raw"; | ||
import { OnyxSystemButton, OnyxTooltip } from "../../.."; | ||
</script> | ||
|
||
<template> | ||
<OnyxTooltip text="Tooltip text"> | ||
<template #default="{ trigger }"> | ||
<OnyxSystemButton v-bind="trigger" label="Button label" :icon="moreVertical" /> | ||
</template> | ||
</OnyxTooltip> | ||
</template> |