feat: implement Portal component and refactor modals to use it for improved positioning

This commit is contained in:
hamed
2026-07-04 22:05:27 +03:30
parent ae1e40aeee
commit f3ca6d844f
9 changed files with 168 additions and 9 deletions
+9
View File
@@ -0,0 +1,9 @@
import React, { useEffect, useState } from 'react';
import { createPortal } from 'react-dom';
export default function Portal({ children }: { children: React.ReactNode }) {
const [mounted, setMounted] = useState(false);
useEffect(() => setMounted(true), []);
if (!mounted) return null;
return createPortal(children, document.body);
}