mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-13 12:37:16 +08:00
[react-albus] Add function-as-children as an alternative to the render-prop to Step
This commit is contained in:
7
types/react-albus/index.d.ts
vendored
7
types/react-albus/index.d.ts
vendored
@@ -1,6 +1,7 @@
|
||||
// Type definitions for react-albus 2.0
|
||||
// Project: https://github.com/americanexpress/react-albus#readme
|
||||
// Definitions by: Sindre Seppola <https://github.com/sseppola>
|
||||
// Conrad Reuter <https://github.com/conradreuter>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
@@ -34,5 +35,7 @@ export const Steps: React.ComponentType<{
|
||||
|
||||
export const Step: React.ComponentType<{
|
||||
id: string;
|
||||
render: (wizard: WizardContext) => React.ReactNode;
|
||||
}>;
|
||||
} & (
|
||||
| { render?: (wizard: WizardContext) => React.ReactNode; }
|
||||
| { children: (wizard: WizardContext) => React.ReactNode; }
|
||||
)>;
|
||||
|
||||
@@ -37,15 +37,20 @@ const Example = () => (
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
<Step
|
||||
id="dumbledore"
|
||||
render={({ previous }) => (
|
||||
<Step id="dumbledore">
|
||||
{({ previous, next }) => (
|
||||
<div>
|
||||
<h1>Dumbledore</h1>
|
||||
<button onClick={previous}>Previous</button>
|
||||
<button onClick={next}>Next</button>
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
</Step>
|
||||
<Step id="harry">
|
||||
<div>
|
||||
<h1>Harry</h1>
|
||||
</div>
|
||||
</Step>
|
||||
</Steps>
|
||||
)}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user