import React, { useEffect, useState } from 'react' import { type Meta, type StoryObj } from '@storybook/react-vite' import { DocsTemplate } from '../../../.storybook' import Stepper from './Stepper' const meta: Meta = { title: 'Components/Stepper', component: Stepper, parameters: { docs: { page: () => ( The Stepper component is designed to guide users through a step-by-step process, such as user setup or any multi-part task. It presents a clear and linear flow, allowing users to complete one step at a time, ensuring they don't miss any crucial actions. The Stepper provides a structured and user-friendly approach to complex processes, ensuring a smooth and efficient user experience. } infoBullets={[ Implement the Stepper component in user setup, registration flows, or any other multi-step tasks where users need to complete sequential actions. , Each step should be clearly labeled within the{' '} Stepper to indicate its purpose and the user's progress in the overall process. , ]} /> ), }, }, decorators: [ (Story) => (
), ], } export default meta type Story = StoryObj const Template: Story = { render: function Render(args) { const [step, setStep] = useState(args.currentStep) const goBack = () => { setStep((prevState) => prevState - 1) } useEffect(() => { setStep(args.currentStep) }, [args.currentStep]) return args.hideBackButton === true ? ( ) : ( ) }, } export const Basic: Story = { ...Template, args: { steps: ['One', 'Two', 'Three', 'Four', 'Five'], currentStep: 1, }, } export const HiddenBackButton: Story = { ...Template, args: { steps: ['One', 'Two', 'Three'], currentStep: 2, hideBackButton: true, }, }