Skip to content

Commit 8b95449

Browse files
committed
Update docs
1 parent 15f2c6a commit 8b95449

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

README.md

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,27 @@ const Simple = () =>
2020
<Steps>
2121
<Step path="firstStep">
2222
<h1>First Step</h1>
23-
<Navigation render={({ next }) => <button onClick={next}>Next</button>} />
23+
<Navigation
24+
render={({ next }) =>
25+
<button onClick={next}>Next</button>}
26+
/>
2427
</Step>
2528
<Step path="secondStep">
2629
<h1>Second Step</h1>
27-
<Navigation render={({ next }) => <button onClick={next}>Next</button>} />
28-
<Navigation render={({ previous }) => <button onClick={previous}>Previous</button>} />
30+
<Navigation
31+
render={({ next, previous }) =>
32+
<div>
33+
<button onClick={next}>Next</button>
34+
<button onClick={previous}>Previous</button>
35+
</div>}
36+
/>
2937
</Step>
3038
<Step path="thirdStep">
3139
<h1>Third Step</h1>
32-
<Navigation render={({ previous }) => <button onClick={previous}>Previous</button>} />
40+
<Navigation
41+
render={({ previous }) =>
42+
<button onClick={previous}>Previous</button>}
43+
/>
3344
</Step>
3445
</Steps>
3546
</Wizard>;
@@ -77,9 +88,9 @@ Wraps all the content that will be conditionally shown when the step is active.
7788

7889
#### Props
7990
##### `path`: string
80-
Unique string for each component, if `routed`, this will be used as the path in the URL.
91+
Unique key for each step.
8192
##### `name`: string *(optional)*
82-
A name for the step that can be used in the `<Progress>` component in order to display step titles.
93+
A name for the step that can later be accessed on [`context.wizard`](#contextwizard).
8394
##### `className`: string *(optional)*
8495
CSS classes to be added to the `<div>` created by `<Step>`.
8596

@@ -95,7 +106,7 @@ An object describing the current step with the signature: `{ path: string, name:
95106
---
96107

97108
### `<Navigation>`
98-
Wrapper component for the Navigation of your `<Step>`. Extends its child's props with [`context.wizard`](#contextwizard) and passes [`context.wizard`](#contextwizard) to its render prop.
109+
Exposes the Wizard navigation functionality for your components to use. Extends its child's props with [`context.wizard`](#contextwizard) and passes [`context.wizard`](#contextwizard) to its render prop.
99110
#### Props
100111
##### `render(wizard)`: function *(optional)*
101112
A function that will be used as the render function of `<Navigation>`.
@@ -130,11 +141,11 @@ import React from 'react';
130141
import { Route } from 'react-router-dom';
131142
import { Wizard } from 'react-albus';
132143

133-
const RoutedWizard = () =>
144+
const RoutedWizard = ({ children }) =>
134145
<Route
135-
render={({ match: { url }, history }) =>
146+
render={({ history, match: { url } }) =>
136147
<Wizard history={history} basename={url}>
137-
...
148+
{children}
138149
</Wizard>}
139150
/>;
140151

src/components/Steps.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Steps extends Component {
2424
path: child.props.path,
2525
name: child.props.name,
2626
}));
27-
this.context.wizard._setSteps(steps); // eslint-disable-line no-underscore-dangle
27+
wizard._setSteps(steps); // eslint-disable-line no-underscore-dangle
2828
}
2929
}
3030

0 commit comments

Comments
 (0)