Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | import { useEffect, useRef } from "react"; import useCurrentStep from "./useCurrentStep"; import updateStepById from "../../../utils/playbook/step/updateStepById"; function useStepDimensions(stepId: string) { const stepRef = useRef<HTMLDivElement>(null); const [step] = useCurrentStep(stepId); const setDimensions = () => { const height = (stepRef.current?.clientHeight ?? 0) + 300; const width = (stepRef.current?.clientWidth ?? 0) + 20; updateStepById("ui_requirement.width", width, stepId); updateStepById("ui_requirement.height", height, stepId); }; useEffect(() => { Iif (stepRef.current) { setDimensions(); } // eslint-disable-next-line react-hooks/exhaustive-deps }, [stepRef.current?.clientHeight, stepRef.current?.clientWidth, step]); return stepRef; } export default useStepDimensions; |