Skip to content

Commit ee3b823

Browse files
committed
fixed: support for passing 'title' prop added to inline mode
1 parent 8626b25 commit ee3b823

File tree

4 files changed

+11
-161
lines changed

4 files changed

+11
-161
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Step:
5050
There are two ways to configure Multistep, with external array:
5151

5252
(* **this is the old way, which is `deprecated` and will be removed in the next major version**)
53+
5354
```javascript
5455
const steps = [
5556
{title: 'StepOne', component: <StepOne/>},
@@ -60,14 +61,14 @@ const steps = [
6061
<Multistep activeStep={1} showNavigation={true} steps={steps}/>
6162
```
6263

63-
or, inline (to suport disabling moving to the next step if form validation is not passing):
64+
or, inline, to support disabling moving to the next step if form validation is not passing:
6465

6566
```javascript
6667
<Multistep activeStep={1} showNavigation={true}>
67-
<StepOne/>
68-
<StepTwo/>
69-
<StepThree/>
70-
<StepFour/>
68+
<StepOne title: 'StepOne'/>
69+
<StepTwo title: 'StepTwo'/>
70+
<StepThree title: 'StepThree'/>
71+
<StepFour title: 'StepFour'/>
7172
</Multistep>
7273
```
7374

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"react": "18.2.0"
3939
},
4040
"scripts": {
41-
"build": "tsc && cp -f ./build/** ./example/node_modules/MultiStep/",
41+
"build": "tsc && mkdir -p ./example/node_modules/MultiStep && cp -f ./build/** ./example/node_modules/MultiStep/",
4242
"bundle": "esbuild ./build/index.js \"--define:process.env.NODE_ENV='production'\" --external:react --bundle --format=cjs --loader:.js=jsx --outdir=dist",
4343
"publish": "npm publish ./"
4444
}

src/MultiStep.js

Lines changed: 0 additions & 152 deletions
This file was deleted.

src/MultiStep.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ const getButtonsState = (indx, length, isValidState) => {
116116
}
117117

118118
export default function MultiStep (props: MultiStepPropsBase) {
119-
const {children} = props
119+
const { children } = props
120+
120121
let stepsArray = props.steps
121122

122123
if (!stepsArray && !children) {
@@ -135,8 +136,8 @@ export default function MultiStep (props: MultiStepPropsBase) {
135136
})
136137
// for backward compatibility we preserve 'steps' with components array:
137138
steps = childrenWithProps.map(childComponent => (
138-
{
139-
title: childComponent.title,
139+
{
140+
title: childComponent.props.title,
140141
component: childComponent
141142
})
142143
)

0 commit comments

Comments
 (0)