mirror of
https://github.com/portainer/portainer.git
synced 2025-08-02 20:35:25 +02:00
refactor(wizard): migrate to react [EE-2305] (#6957)
This commit is contained in:
parent
3aacaa7caf
commit
01dc9066b7
125 changed files with 2994 additions and 1744 deletions
43
app/react/components/Stepper/Stepper.stories.tsx
Normal file
43
app/react/components/Stepper/Stepper.stories.tsx
Normal file
|
@ -0,0 +1,43 @@
|
|||
import { Meta } from '@storybook/react';
|
||||
import { useState } from 'react';
|
||||
|
||||
import { Button } from '@/portainer/components/Button';
|
||||
|
||||
import { Step, Stepper } from './Stepper';
|
||||
|
||||
export default {
|
||||
component: Stepper,
|
||||
title: 'Components/Stepper',
|
||||
} as Meta;
|
||||
|
||||
interface Args {
|
||||
totalSteps: number;
|
||||
}
|
||||
|
||||
function Template({ totalSteps = 5 }: Args) {
|
||||
const steps: Step[] = Array.from({ length: totalSteps }).map((_, index) => ({
|
||||
title: `step ${index + 1}`,
|
||||
}));
|
||||
|
||||
const [currentStep, setCurrentStep] = useState(1);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stepper currentStep={currentStep} steps={steps} />
|
||||
<Button
|
||||
onClick={() => setCurrentStep(currentStep - 1)}
|
||||
disabled={currentStep <= 1}
|
||||
>
|
||||
Previous
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => setCurrentStep(currentStep + 1)}
|
||||
disabled={currentStep >= steps.length}
|
||||
>
|
||||
Next
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export { Template };
|
Loading…
Add table
Add a link
Reference in a new issue