@@ -11,6 +11,7 @@ import './wizard/wizard-styles.scss';
1111
1212import WizardNavigation from './wizard/wizard-nav' ;
1313import reducer from './wizard/reducer' ;
14+ import WizardToggle from './wizard/wizard-toggle' ;
1415
1516const Modal = ( { children, container, inModal } ) =>
1617 inModal
@@ -55,7 +56,7 @@ const WizardInternal = ({
5556 maxStepIndex,
5657 isDynamic
5758 } = useContext ( WizardContext ) ;
58- const [ state , dispatch ] = useReducer ( reducer , { loading : true , container } ) ;
59+ const [ state , dispatch ] = useReducer ( reducer , { loading : true , container, openNav : false } ) ;
5960
6061 useEffect ( ( ) => {
6162 if ( inModal ) {
@@ -102,17 +103,27 @@ const WizardInternal = ({
102103 closeButtonAriaLabel = { closeButtonAriaLabel }
103104 />
104105 ) }
106+ < WizardToggle
107+ activeStepIndex = { activeStepIndex + 1 }
108+ activeStepName = { currentStep . title }
109+ activeStepSubName = { navSchema . find ( ( step ) => step . name === currentStep . name ) ?. substepOfTitle }
110+ isOpen = { state . openNav }
111+ dispatch = { dispatch }
112+ />
105113 < div className = "pf-c-wizard__outer-wrap" >
106114 < div className = "pf-c-wizard__inner-wrap" >
107- < WizardNav aria-label = { navAriaLabel } >
115+ < WizardNav aria-label = { navAriaLabel } isOpen = { state . openNav } >
108116 < FormSpy subscription = { { values : true , valid : true , validating : true } } >
109117 { ( { values, valid, validating } ) => (
110118 < WizardNavigation
111119 navSchema = { navSchema }
112120 activeStepIndex = { activeStepIndex }
113121 valid = { valid }
114122 maxStepIndex = { maxStepIndex }
115- jumpToStep = { jumpToStep }
123+ jumpToStep = { ( ...args ) => {
124+ state . openNav && dispatch ( { type : 'closeNav' } ) ;
125+ return jumpToStep ( ...args ) ;
126+ } }
116127 crossroads = { crossroads }
117128 isDynamic = { isDynamic }
118129 values = { values }
0 commit comments