UNPKG

@coveord/plasma-mantine

Version:

A Plasma flavoured Mantine theme

31 lines (30 loc) 1.09 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { useRef, useEffect } from 'react'; import { factory } from '@mantine/core'; import { StickyFooter } from '../StickyFooter/StickyFooter.js'; import classes from './ModalFooter.module.css'; const ensuresFooterHasEvenHeight = (footer)=>{ const remainder = footer.offsetHeight % 2; footer.style.height = `${footer.offsetHeight - remainder + 2}px`; }; export const ModalFooter = factory((props, ref)=>{ const _ref = useRef(null); const footerRef = ref || _ref; useEffect(()=>{ 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__*/ _jsx(StickyFooter, { borderTop: true, className: classes.root, ref: footerRef, ...props }); }); ModalFooter.displayName = 'Modal.Footer'; //# sourceMappingURL=ModalFooter.js.map