1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2025-01-05 16:57:41 +01:00

put cleanup in correct place

This commit is contained in:
mrjvs 2023-10-09 21:02:18 +02:00
parent d485d3200b
commit 68441b90e5

View file

@ -12,15 +12,8 @@ export interface OverlayProps {
} }
export function OverlayDisplay(props: { children: ReactNode }) { export function OverlayDisplay(props: { children: ReactNode }) {
return <div className="popout-location">{props.children}</div>; const router = useInternalOverlayRouter("hello world :)");
}
export function Overlay(props: OverlayProps) {
const router = useInternalOverlayRouter(props.id);
const refRouter = useRef(router); const refRouter = useRef(router);
const [portalElement, setPortalElement] = useState<Element | null>(null);
const ref = useRef<HTMLDivElement>(null);
const target = useRef<Element | null>(null);
// close router on first mount, we dont want persist routes for overlays // close router on first mount, we dont want persist routes for overlays
useEffect(() => { useEffect(() => {
@ -30,6 +23,14 @@ export function Overlay(props: OverlayProps) {
r.close(); r.close();
}; };
}, []); }, []);
return <div className="popout-location">{props.children}</div>;
}
export function Overlay(props: OverlayProps) {
const router = useInternalOverlayRouter(props.id);
const [portalElement, setPortalElement] = useState<Element | null>(null);
const ref = useRef<HTMLDivElement>(null);
const target = useRef<Element | null>(null);
useEffect(() => { useEffect(() => {
function listen(e: MouseEvent) { function listen(e: MouseEvent) {