diff --git a/src/components/Common/Loading.tsx b/src/components/Common/Loading.tsx index 212a31e17e2..dd8013546d4 100644 --- a/src/components/Common/Loading.tsx +++ b/src/components/Common/Loading.tsx @@ -1,16 +1,41 @@ -const img = "/images/care_logo_gray.svg"; +import { useEffect, useRef, useState } from "react"; const Loading = () => { + const containerRef = useRef(null); + const [offsetTop, setOffsetTop] = useState(0); + + useEffect(() => { + const calculateOffset = () => { + if (containerRef.current) { + const rect = containerRef.current.getBoundingClientRect(); + setOffsetTop(rect.top); + } + }; + + calculateOffset(); + + window.addEventListener("resize", calculateOffset); + window.addEventListener("scroll", calculateOffset, true); + + return () => { + window.removeEventListener("resize", calculateOffset); + window.removeEventListener("scroll", calculateOffset, true); + }; + }, []); + return ( -
-
-
-
- logo -
-
-
+
+ loading
); }; + export default Loading;