1
0
Fork 0
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:
Chaim Lev-Ari 2022-05-23 17:32:51 +03:00 committed by GitHub
parent 3aacaa7caf
commit 01dc9066b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
125 changed files with 2994 additions and 1744 deletions

View 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 };