UNPKG

@primer/react-brand

Version:

Primer Brand is a GitHub's design system for creating React-based marketing websites and digital experiences.

25 lines (24 loc) 705 B
import { useEffect as e, useState as t } from "react"; //#region src/VideoPlayer/hooks/useVideoResizeObserver.ts var n = ({ videoWrapperRef: n, className: r }) => { let [i, a] = t(!1); return e(() => { let e = () => { if (!n.current) return; let e = n.current.getBoundingClientRect().width, t = !!(e && e < 544); a(t), t ? n.current.classList.add(r) : n.current.classList.remove(r); }, t = new ResizeObserver((t) => { n.current && e(); }); e(); let i = n.current; return i ? (t.observe(i), () => { t.unobserve(i); }) : () => { t.disconnect(); }; }, [r, n]), i; }; //#endregion export { n as useVideoResizeObserver }; //# sourceMappingURL=useVideoResizeObserver.js.map