"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useBodyScrollLock = void 0;
const react_1 = require("react");
const utils_1 = require("../../utils");
const consts_1 = require("./consts");
const useBodyScrollLock = () => {
    const [isScrollLocked, setIsScrollLocked] = (0, react_1.useState)(false);
    const toggleIsScrollLocked = () => setIsScrollLocked(!isScrollLocked);
    (0, react_1.useEffect)(() => {
        if (isScrollLocked)
            (0, utils_1.addBodyClass)(consts_1.noScrollClass);
        else
            (0, utils_1.removeBodyClass)(consts_1.noScrollClass);
        return () => (0, utils_1.removeBodyClass)(consts_1.noScrollClass);
    }, [isScrollLocked]);
    return { isScrollLocked, setIsScrollLocked, toggleIsScrollLocked };
};
exports.useBodyScrollLock = useBodyScrollLock;
//# sourceMappingURL=useBodyScrollLock.js.map