Debian Codegraph @

node/@patternfly/react-core/dist/js/components/Wizard/hooks/useWizardFooter.js

raw
1 "use strict";
2 Object.defineProperty(exports, "__esModule", { value: true });
3 exports.useWizardFooter = void 0;
4 const react_1 = require("react");
5 const WizardContext_1 = require("../WizardContext");
6 /**
7 * Set a unique footer for the wizard. stepId is only required if inactive steps are hidden instead of unmounted.
8 * @param footer
9 * @param stepId
10 */
11 const useWizardFooter = (footer, stepId) => {
12 const { activeStep, setFooter } = (0, WizardContext_1.useWizardContext)();
13 (0, react_1.useEffect)(() => {
14 if (footer && (!stepId || (activeStep === null || activeStep === void 0 ? void 0 : activeStep.id) === stepId)) {
15 setFooter(footer);
16 // Reset the footer on unmount.
17 return () => {
18 setFooter(null);
19 };
20 }
21 }, [activeStep, footer, setFooter, stepId]);
22 };
23 exports.useWizardFooter = useWizardFooter;
24 //# sourceMappingURL=useWizardFooter.js.map