UNPKG

@coveord/plasma-mantine

Version:

A Plasma flavoured Mantine theme

32 lines (31 loc) 1.11 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { useRef, useEffect } from 'react'; import clsx from 'clsx'; import { factory } from '@mantine/core'; import { StickyFooter } from '../sticky-footer'; import classes from './Modal.module.css'; const ensuresFooterHasEvenHeight = (footer)=>{ const remainder = footer.offsetHeight % 2; footer.style.height = `${footer.offsetHeight - remainder + 2}px`; }; export const ModalFooter = factory(({ sticky, ...props }, ref)=>{ const _ref = useRef(); 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, { className: clsx(classes.footer, { [classes.modalFooterSticky]: !!sticky }), ref: footerRef, ...props }); }); //# sourceMappingURL=ModalFooter.js.map