File tree Expand file tree Collapse file tree 5 files changed +83
-9
lines changed
Expand file tree Collapse file tree 5 files changed +83
-9
lines changed Original file line number Diff line number Diff line change 11import { styled } from 'goober' ;
22import * as React from 'react' ;
33
4- import { useWizard } from '../../dist' ;
5- import { Button } from '../modules/common' ;
4+ import { useWizard } from '../../../ dist' ;
5+ import { Button } from '../../ modules/common' ;
66
7- const Actions = styled ( 'div' ) `
7+ export const Actions = styled ( 'div' ) `
88 display: flex;
99 justify-content: center;
1010 margin: 1rem 0;
1111 gap: 1rem;
1212 flex-direction: row;
1313` ;
1414
15- const Info = styled ( 'div' ) `
15+ export const Info = styled ( 'div' ) `
1616 display: flex;
1717 justify-content: center;
1818 flex-direction: column;
@@ -32,7 +32,7 @@ const Info = styled('div')`
3232 }
3333` ;
3434
35- const Footer : React . FC = React . memo ( ( ) => {
35+ const Footer : React . FC = ( ) => {
3636 const {
3737 nextStep,
3838 previousStep,
@@ -57,20 +57,20 @@ const Footer: React.FC = React.memo(() => {
5757 < Actions >
5858 < Button
5959 label = "Previous"
60- onClick = { previousStep }
60+ onClick = { ( ) => previousStep ( ) }
6161 disabled = { isLoading || isFirstStep }
6262 >
6363 Previous
6464 </ Button >
6565 < Button
6666 label = "Next"
67- onClick = { nextStep }
67+ onClick = { ( ) => nextStep ( ) }
6868 disabled = { isLoading || isLastStep }
6969 />
7070 </ Actions >
7171 </ code >
7272 </ >
7373 ) ;
74- } ) ;
74+ } ;
7575
7676export default Footer ;
Original file line number Diff line number Diff line change 1+ import * as React from 'react' ;
2+
3+ import { useWizard } from '../../../dist' ;
4+ import { Button } from '../../modules/common' ;
5+ import { Actions , Info } from './footer' ;
6+
7+ const FooterCustomStepIndex : React . FC = ( ) => {
8+ const {
9+ nextStep,
10+ previousStep,
11+ isLoading,
12+ activeStep,
13+ isLastStep,
14+ isFirstStep,
15+ } = useWizard ( ) ;
16+
17+ return (
18+ < >
19+ < code >
20+ < Info >
21+ < p > Has previous step: { ! isFirstStep ? '✅' : '⛔' } </ p >
22+ < br />
23+ < p > Has next step: { ! isLastStep ? '✅' : '⛔' } </ p >
24+ < br />
25+ < p >
26+ Active step: { activeStep + 1 } < br />
27+ </ p >
28+ </ Info >
29+ < Actions >
30+ < Button
31+ label = "Previous"
32+ onClick = { ( ) => previousStep ( ) }
33+ disabled = { isLoading || isFirstStep }
34+ >
35+ Previous
36+ </ Button >
37+ < Button
38+ label = "Next"
39+ onClick = { ( ) => nextStep ( 2 ) }
40+ disabled = { isLoading || isLastStep }
41+ />
42+ </ Actions >
43+ </ code >
44+ </ >
45+ ) ;
46+ } ;
47+
48+ export default FooterCustomStepIndex ;
Original file line number Diff line number Diff line change 11export { default as Step } from './step' ;
22export { default as AsyncStep } from './asyncStep' ;
3- export { default as Footer } from './footer' ;
3+ export { default as Footer } from './footer/footer' ;
4+ export { default as FooterStepIndex } from './footer/footerStepIndex' ;
45export { default as AnimatedStep } from './animatedStep' ;
56export { default as Tooltip } from './tooltip' ;
Original file line number Diff line number Diff line change 1+ import * as React from 'react' ;
2+
3+ import { Wizard } from '../../../../dist' ;
4+ import { AsyncStep , FooterStepIndex , Step } from '../../../components' ;
5+ import Section from '../../common/section' ;
6+
7+ const CustomNextStepIndex : React . FC = ( ) => {
8+ return (
9+ < Section
10+ title = "Custom step index"
11+ description = "With custom step index on next step"
12+ >
13+ < Wizard footer = { < FooterStepIndex /> } >
14+ < AsyncStep number = { 1 } />
15+ < Step number = { 2 } />
16+ < AsyncStep number = { 3 } />
17+ < Step number = { 4 } />
18+ </ Wizard >
19+ </ Section >
20+ ) ;
21+ } ;
22+
23+ export default CustomNextStepIndex ;
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { styled } from 'goober';
22import * as React from 'react' ;
33
44import AnimatedSection from './animated' ;
5+ import CustomNextStepIndex from './customNextStepIndex' ;
56import ReactQuerySection from './reactQuery' ;
67import SimpleSection from './simple' ;
78
@@ -17,6 +18,7 @@ const WizardModule = () => {
1718 < SimpleSection />
1819 < AnimatedSection />
1920 < ReactQuerySection />
21+ < CustomNextStepIndex />
2022 </ Container >
2123 ) ;
2224} ;
You can’t perform that action at this time.
0 commit comments