Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ https://steps.vercel.app/
<td>size of Steps, could be `small`</td>
</tr>
<tr>
<td>labelPlacement</td>
<td>titlePlacement</td>
<td>string</td>
<td></td>
<td>placement of step title, could be `vertical`</td>
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/alternativeLabel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const description =

export default () => (
<Steps
labelPlacement="vertical"
titlePlacement="vertical"
current={1}
items={[
{
Expand Down
10 changes: 5 additions & 5 deletions src/Steps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export interface StepsProps {

// layout
orientation?: 'horizontal' | 'vertical';
labelPlacement?: 'horizontal' | 'vertical';
titlePlacement?: 'horizontal' | 'vertical';

// data
status?: Status;
Expand All @@ -82,7 +82,7 @@ export default function Steps(props: StepsProps) {

// layout
orientation = 'horizontal',
labelPlacement = 'horizontal',
titlePlacement = 'horizontal',

// data
status = 'process',
Expand All @@ -102,14 +102,14 @@ export default function Steps(props: StepsProps) {
// ============================= layout =============================
const isVertical = orientation === 'vertical';
const mergedOrientation = isVertical ? 'vertical' : 'horizontal';
const mergeLabelPlacement =
!isVertical && labelPlacement === 'vertical' ? 'vertical' : 'horizontal';
const mergeTitlePlacement =
!isVertical && titlePlacement === 'vertical' ? 'vertical' : 'horizontal';

// ============================= styles =============================
const classString = cls(
prefixCls,
`${prefixCls}-${mergedOrientation}`,
`${prefixCls}-label-${mergeLabelPlacement}`,
`${prefixCls}-title-${mergeTitlePlacement}`,
rootClassName,
className,
classNames.root,
Expand Down
Loading