-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add loading state and direct linking to projects
- Loading branch information
1 parent
c62e1ac
commit 4409ac9
Showing
5 changed files
with
63 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,46 @@ | ||
"use client"; | ||
|
||
import { useAtomValue } from "jotai"; | ||
import { useEffect, useState } from "react"; | ||
|
||
import { activeProjectAtom } from "../utils/state"; | ||
import { activeProjectAtom, isLoadingAtom } from "../utils/state"; | ||
import { OPEN_ANIMATION_DURATION_CLASS } from "../utils/constants"; | ||
|
||
export default function BlurOverlay() { | ||
const isLoading = useAtomValue(isLoadingAtom); | ||
const activeProject = useAtomValue(activeProjectAtom); | ||
const [inFront, setInFront] = useState(true); | ||
|
||
useEffect(() => { | ||
if (!isLoading) { | ||
setTimeout(() => setInFront(false), 500); | ||
} | ||
}, [isLoading]); | ||
|
||
return ( | ||
<div | ||
className={`fixed top-0 w-screen h-screen transition ${OPEN_ANIMATION_DURATION_CLASS} ${ | ||
activeProject !== null ? "opacity-100 z-[900]" : "opacity-0" | ||
} backdrop-blur-sm`} | ||
/> | ||
<> | ||
<div | ||
className={`fixed top-0 w-screen h-screen transition ${OPEN_ANIMATION_DURATION_CLASS} ${ | ||
isLoading || activeProject !== null | ||
? "opacity-100 z-[900]" | ||
: "opacity-0" | ||
} ${isLoading ? "backdrop-blur-lg" : "backdrop-blur-sm"} ${ | ||
inFront ? "z-[900]" : "" | ||
}`} | ||
> | ||
<div | ||
className={`absolute transition-all ${OPEN_ANIMATION_DURATION_CLASS} ${ | ||
isLoading ? "top-0 opacity-100" : "top-[60vh] opacity-0" | ||
}`} | ||
> | ||
<div className="flex items-center justify-center w-screen h-screen"> | ||
<div className="flex justify-center items-center w-32 h-32 bg-white border-white border-8 shadow-2xl rounded-lg"> | ||
<div className="absolute w-16 h-16 rounded-full border-8 border-blue-500" /> | ||
<div className="w-16 h-16 border-r-8 border-t-8 border-teal-400 rounded-full z-[10] animate-spin" /> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters