Skip to content

Commit

Permalink
docs: update OnyxFlyoutMenu example (#1847)
Browse files Browse the repository at this point in the history
The example for the OnyxFlyoutMenu had a missing `label` property.
I also changed the example to a more realistic use case (language
selection) so its easier for projects to check when the flyout menu can
be used.
  • Loading branch information
larsrickert committed Sep 11, 2024
1 parent 55691c0 commit cc2c19e
Showing 1 changed file with 10 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import globe from "@sit-onyx/icons/globe.svg?raw";
import type { Meta, StoryObj } from "@storybook/vue3";
import { h } from "vue";
import OnyxButton from "../../../OnyxButton/OnyxButton.vue";
Expand Down Expand Up @@ -32,25 +33,19 @@ const meta: Meta<typeof OnyxFlyoutMenu> = {
export default meta;
type Story = StoryObj<typeof OnyxFlyoutMenu>;

const listAnimals = [
{ label: "Cat" },
{ label: "Dog" },
{ label: "Tiger" },
{ label: "Reindeer" },
{ label: "Racoon" },
{ label: "Dolphin" },
{ label: "Flounder" },
{ label: "Eel" },
{ label: "Falcon" },
{ label: "Owl" },
];

/**
* This example shows a basic OnyxFlyoutMenu
*/
export const Default = {
args: {
default: () => [h(OnyxButton, { label: "Hover me" })],
options: () => listAnimals.map(({ label }) => h(OnyxMenuItem, () => label)),
label: "Choose application language",
default: () => [
h(OnyxButton, { label: "English", mode: "plain", color: "neutral", icon: globe }),
],
options: () => [
h(OnyxMenuItem, { active: true }, () => "English"),
h(OnyxMenuItem, () => "German"),
h(OnyxMenuItem, () => "Spanish"),
],
},
} satisfies Story;

0 comments on commit cc2c19e

Please sign in to comment.