UNPKG

1.65 kBTypeScriptView Raw
1import { storiesOf } from "@storybook/react";
2import * as React from "react";
3const useState = React.useState;
4import { Steps} from "../components/Steps";
5import {Button} from '../components/Button';
6const {Step} = Steps;
7storiesOf("Steps", module).add("Examples", () => {
8 const [currentStep, setStep] = useState(0);
9 const handleChange = (curr: any) => {
10 setStep(curr);
11 }
12 return (
13 <div className="storycontainer">
14 <div className="story-module" >
15 <h3>Steps Small</h3>
16 <p>Note, in order to achieve figma specifications, the text on top of the bubbles will have to overflow their containers for now, this will have to be handled by the user. If you don't need icons for the various steps, use the next module</p>
17 <Steps size="small" current={currentStep} style={{width: 'calc(100% - 40px)', marginLeft: '20px'}} onChange={handleChange}>
18 <Step title="Finished" />
19 <Step title="In Progress" />
20 <Step title="Waiting" />
21 </Steps>
22 <br/>
23 <Button onClick={()=> {
24 setStep(currentStep < 3 ? currentStep+1 : 3);
25 }}>Next</Button>
26 <Button type="primary-outline" size="small" onClick={()=> {
27 setStep(currentStep > 0 ? currentStep-1 : 0);
28 }}>Previous</Button>
29 </div>
30
31 <div className="story-module" >
32 <h3>Progress with Dots and clickable progress</h3>
33 <Steps progressDot current={currentStep} onChange={handleChange}>
34 <Step title="Finished" description="This is a description."/>
35 <Step title="In Progress" description="This is a description." />
36 <Step title="Waiting" description="This is a description." />
37 </Steps>
38 </div>
39 </div>
40)});