This commit is contained in:
Ole
2026-05-31 20:25:41 +00:00
commit 0a07ab8593
275 changed files with 52660 additions and 0 deletions
@@ -0,0 +1,27 @@
import { type ReactNode, type ReactElement, useRef, useEffect } from 'react';
import { createPortal } from 'react-dom';
import { useRevealContext } from '../hooks/useRevealContext';
export function RevealCanvas({
children,
}: {
children?: ReactNode;
}): ReactElement {
const { viewer } = useRevealContext();
const parentElement = useRef<HTMLDivElement>(null);
useEffect(() => {
if (parentElement.current !== null) {
parentElement.current.appendChild(viewer.domElement);
}
}, [viewer]);
return (
<div
style={{ width: '100%', height: '100%', overflow: 'hidden' }}
ref={parentElement}
>
{createPortal(children, viewer.domElement)}
</div>
);
}