| 1 |
import { useEffect } from 'react'; |
| 2 |
import { useWizardContext } from '../WizardContext'; |
| 3 |
/** |
| 4 |
* Set a unique footer for the wizard. stepId is only required if inactive steps are hidden instead of unmounted. |
| 5 |
* @param footer |
| 6 |
* @param stepId |
| 7 |
*/ |
| 8 |
export const useWizardFooter = (footer, stepId) => { |
| 9 |
const { activeStep, setFooter } = useWizardContext(); |
| 10 |
useEffect(() => { |
| 11 |
if (footer && (!stepId || (activeStep === null || activeStep === void 0 ? void 0 : activeStep.id) === stepId)) { |
| 12 |
setFooter(footer); |
| 13 |
// Reset the footer on unmount. |
| 14 |
return () => { |
| 15 |
setFooter(null); |
| 16 |
}; |
| 17 |
} |
| 18 |
}, [activeStep, footer, setFooter, stepId]); |
| 19 |
}; |
| 20 |
//# sourceMappingURL=useWizardFooter.js.map |