|
| 1 | +import type { Meta, StoryObj } from "@storybook/react-vite"; |
| 2 | +import { ActionSelector } from "./ActionSelector"; |
| 3 | + |
| 4 | +const meta: Meta<typeof ActionSelector> = { |
| 5 | + title: "Components/ActionSelector", |
| 6 | + component: ActionSelector, |
| 7 | + parameters: { |
| 8 | + layout: "padded", |
| 9 | + }, |
| 10 | + argTypes: { |
| 11 | + onSelect: { action: "selected" }, |
| 12 | + onMultiSelect: { action: "multiSelected" }, |
| 13 | + onCancel: { action: "cancelled" }, |
| 14 | + onStepAnswer: { action: "stepAnswered" }, |
| 15 | + }, |
| 16 | +}; |
| 17 | + |
| 18 | +export default meta; |
| 19 | +type Story = StoryObj<typeof ActionSelector>; |
| 20 | + |
| 21 | +export const SingleSelect: Story = { |
| 22 | + args: { |
| 23 | + title: "Single Select", |
| 24 | + question: "Choose one option:", |
| 25 | + options: [ |
| 26 | + { id: "a", label: "Option A", description: "First option" }, |
| 27 | + { id: "b", label: "Option B", description: "Second option" }, |
| 28 | + { id: "c", label: "Option C", description: "Third option" }, |
| 29 | + ], |
| 30 | + }, |
| 31 | +}; |
| 32 | + |
| 33 | +export const WithCustomInput: Story = { |
| 34 | + args: { |
| 35 | + title: "With Custom Input", |
| 36 | + question: "Choose an option or provide your own:", |
| 37 | + options: [ |
| 38 | + { id: "a", label: "Option A" }, |
| 39 | + { id: "b", label: "Option B" }, |
| 40 | + ], |
| 41 | + allowCustomInput: true, |
| 42 | + customInputPlaceholder: "Type your answer...", |
| 43 | + }, |
| 44 | +}; |
| 45 | + |
| 46 | +export const MultiSelect: Story = { |
| 47 | + args: { |
| 48 | + title: "Multi Select", |
| 49 | + question: "Select all that apply:", |
| 50 | + options: [ |
| 51 | + { id: "react", label: "React", description: "UI library" }, |
| 52 | + { id: "vue", label: "Vue", description: "Progressive framework" }, |
| 53 | + { id: "svelte", label: "Svelte", description: "Compiler-based" }, |
| 54 | + { id: "angular", label: "Angular", description: "Full framework" }, |
| 55 | + ], |
| 56 | + multiSelect: true, |
| 57 | + }, |
| 58 | +}; |
| 59 | + |
| 60 | +export const MultiSelectWithOther: Story = { |
| 61 | + args: { |
| 62 | + title: "Multi Select with Other", |
| 63 | + question: "Which features do you want?", |
| 64 | + options: [ |
| 65 | + { id: "auth", label: "Authentication" }, |
| 66 | + { id: "db", label: "Database" }, |
| 67 | + { id: "api", label: "REST API" }, |
| 68 | + ], |
| 69 | + multiSelect: true, |
| 70 | + allowCustomInput: true, |
| 71 | + customInputPlaceholder: "Describe additional features...", |
| 72 | + }, |
| 73 | +}; |
| 74 | + |
| 75 | +export const WithSteps: Story = { |
| 76 | + args: { |
| 77 | + title: "Frontend", |
| 78 | + question: "Which frontend framework do you prefer?", |
| 79 | + options: [ |
| 80 | + { |
| 81 | + id: "react", |
| 82 | + label: "React", |
| 83 | + description: "Component-based UI library", |
| 84 | + }, |
| 85 | + { id: "vue", label: "Vue", description: "Progressive framework" }, |
| 86 | + { id: "svelte", label: "Svelte", description: "Compiler-based" }, |
| 87 | + ], |
| 88 | + multiSelect: true, |
| 89 | + allowCustomInput: true, |
| 90 | + customInputPlaceholder: "Type something", |
| 91 | + currentStep: 0, |
| 92 | + steps: [ |
| 93 | + { label: "Frontend" }, |
| 94 | + { label: "Backend" }, |
| 95 | + { label: "Databases" }, |
| 96 | + { label: "Submit" }, |
| 97 | + ], |
| 98 | + }, |
| 99 | +}; |
0 commit comments