UNPKG

@coveord/plasma-mantine

Version:

A Plasma flavoured Mantine theme

42 lines (41 loc) 1.63 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "ModalFooter", { enumerable: true, get: function() { return ModalFooter; } }); var _interop_require_default = require("@swc/helpers/_/_interop_require_default"); var _object_spread = require("@swc/helpers/_/_object_spread"); var _jsxruntime = require("react/jsx-runtime"); var _react = require("react"); var _core = require("@mantine/core"); var _StickyFooter = require("../StickyFooter/StickyFooter.js"); var _ModalFootermodulecss = /*#__PURE__*/ _interop_require_default._(require("./ModalFooter.module.css")); var ensuresFooterHasEvenHeight = function ensuresFooterHasEvenHeight(footer) { var remainder = footer.offsetHeight % 2; footer.style.height = "".concat(footer.offsetHeight - remainder + 2, "px"); }; var ModalFooter = (0, _core.factory)(function(props, ref) { var _ref = (0, _react.useRef)(null); var footerRef = ref || _ref; (0, _react.useEffect)(function() { if (typeof footerRef !== 'function' && footerRef.current) { ensuresFooterHasEvenHeight(footerRef.current); } // if ref === 'function', this is a callback ref. Haven't found any solution for adjusting the height in this case }, [ ref, props.h ]); return /*#__PURE__*/ (0, _jsxruntime.jsx)(_StickyFooter.StickyFooter, _object_spread._({ borderTop: true, className: _ModalFootermodulecss.default.root, ref: footerRef }, props)); }); ModalFooter.displayName = 'Modal.Footer'; //# sourceMappingURL=ModalFooter.js.map