import React, { useState } from 'react';
import { Form } from '../../form';
import Radio from '../../radio';
import Step from '../step';
import Steps from '../index';
import Icon from '../../icons';
import Button from '../../button';
import { IconTriangleDown, IconClear, IconTick, IconClose, IconBell } from '@douyinfe/semi-icons';
export default {
title: 'Steps'
}
const sizes = ['default', 'small'];
const AllSteps = () => {
const [stepProps, setProps] = useState({
type: 'basic',
size: 'small',
current: 0,
hasLine: true,
direction: 'horizontal',
initial: 0,
status: 'finish',
});
return (
<>
fill
basic
nav
small
default
true
false
horizontal
vertical
wait
process
finish
error
warning
}
description="This is a long descriptionThis is a long descriptionThis is a long descriptionThis is a long descriptionThis is a long descriptionThis is a long description"
>
>
);
};
export const _AllSteps = () => ;
_AllSteps.story = {
name: 'all steps',
};
const FillStep = () => {
return sizes.map(s => (
));
};
export const StepsDefaultFill = () => ;
StepsDefaultFill.story = {
name: 'steps default fill',
};
const BasicStep = () => {
return sizes.map(s => (
));
};
export const StepsBasic = () => ;
StepsBasic.story = {
name: 'steps basic',
};
export const StepsWithIcon = () => {
return (
} />
} />
} />
} />
);
};
StepsWithIcon.story = {
name: 'steps with icon',
};
const steps = [
{
title: 'First',
content: 'First-content',
},
{
title: 'Second',
content: 'Second-content',
},
{
title: 'Last',
content: 'Last-content',
},
];
class StepsDemo extends React.Component {
constructor(props) {
super(props);
this.state = {
current: 0,
};
}
next() {
const current = this.state.current + 1;
this.setState({
current,
});
}
prev() {
const current = this.state.current - 1;
this.setState({
current,
});
}
render() {
const { current } = this.state;
return (
{steps.map(item => (
))}
{steps[current].content}
{current < steps.length - 1 && (
)}
{current === steps.length - 1 && (
)}
{current > 0 && (
)}
);
}
}
export const StepsWithControlled = () => {
return ;
};
StepsWithControlled.story = {
name: 'steps with controlled',
};
class StepsWithonChange extends React.Component {
constructor(props) {
super(props);
this.state = {
current: 1,
};
}
onChange(current) {
this.setState({ current });
}
render() {
const { current } = this.state;
const { Step } = Steps;
const steps = [
{
title: 'First',
content: 'First-content',
},
{
title: 'Second',
content: 'Second-content',
},
{
title: 'Last',
content: 'Last-content',
},
];
return (
this.onChange(current)}>
{steps.map(item => (
))}
);
}
}
export const StepsWithOnChange = () => {
return ;
};
StepsWithOnChange.story = {
name: 'steps with onChange',
};
const StatusStep = () => {
return sizes.map(s => (
));
};
export const StepsWithStatus = () => ;
StepsWithStatus.story = {
name: 'steps with status',
};
const VerticalStep = () => {
return sizes.map(s => (
));
};
export const StepsVertical = () => ;
StepsVertical.story = {
name: 'steps vertical',
};
const LineStep = () => {
return sizes.map(s => (
));
};
export const StepsWithoutLine = () => ;
StepsWithoutLine.story = {
name: 'steps without line',
};