diff --git a/client/src/app/layout.tsx b/client/src/app/layout.tsx index 59faebe..32db41d 100644 --- a/client/src/app/layout.tsx +++ b/client/src/app/layout.tsx @@ -10,7 +10,7 @@ export default function RootLayout({ - + Notoria diff --git a/client/src/app/login/page.tsx b/client/src/app/login/page.tsx index 64bad3e..caba13f 100644 --- a/client/src/app/login/page.tsx +++ b/client/src/app/login/page.tsx @@ -1,18 +1,25 @@ "use client"; -import Spline from "@splinetool/react-spline"; -import { useState } from "react"; import Head from "next/head"; -import { Suspense } from "react"; +import React, { useState } from 'react'; + +const Spline = React.lazy(() => import("@splinetool/react-spline")); const Page = () => { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); + const [isLoading, setIsLoading] = useState(true); const handleSubmit = (e: any) => { e.preventDefault(); }; + const handleIsLoading = () => { + setTimeout(() => { + setIsLoading(false); + }, 400); + }; + return ( <> @@ -28,59 +35,68 @@ const Page = () => { crossOrigin="anonymous" /> -
+
-
-
- - setEmail(e.target.value)} - required - className="mt-1 p-2 block w-fill border border-gray-300 rounded-md shadow-sm text-black font-custom" - /> -
- -
- - setPassword(e.target.value)} - required - className="mt-1 p-2 block w-full border border-gray-300 rounded-md shadow-sm text-black font-custom" - /> + {isLoading && ( +
+
+ )} - - +
+ + setEmail(e.target.value)} + required + className="mt-1 p-2 block border border-gray-300 rounded-md shadow-sm text-black font-custom w-[14vw]" + /> +
+ +
+ + setPassword(e.target.value)} + required + className="mt-1 p-2 block border border-gray-300 rounded-md shadow-sm text-black font-custom w-[14vw]" + /> +
+ + + + )}
); diff --git a/client/src/app/page.tsx b/client/src/app/page.tsx index 9d2c663..5b3d7df 100644 --- a/client/src/app/page.tsx +++ b/client/src/app/page.tsx @@ -1,9 +1,10 @@ "use client"; -import Spline from "@splinetool/react-spline"; import { useRouter } from "next/navigation"; import Head from "next/head"; -import { Suspense } from "react"; +import React, { useState } from 'react'; + +const Spline = React.lazy(() => import("@splinetool/react-spline")); const Page = () => { const router = useRouter(); @@ -11,6 +12,14 @@ const Page = () => { router.push("./login"); }; + const [isLoading, setIsLoading] = useState(true); + + const handleSceneLoad = () => { + setTimeout(() => { + setIsLoading(false); + }, 250); + }; + return ( <> @@ -26,20 +35,28 @@ const Page = () => { crossOrigin="anonymous" /> -
- Loading...
}> - - - -
+
+ + + {isLoading && ( +
+
+
+ )} + + {!isLoading && ( + + )} +
); };