-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from Kodiererin/Loader
Added a loader in the web-app.
- Loading branch information
Showing
5 changed files
with
95 additions
and
27 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React, { useEffect, useState } from "react"; | ||
import { motion, AnimatePresence } from "framer-motion"; | ||
import logo from "../assets/images/codex-logo.png"; | ||
|
||
const Loader = ({ loading }) => { | ||
const [showExplore, setShowExplore] = useState(false); | ||
|
||
useEffect(() => { | ||
const timer = setTimeout(() => { | ||
setShowExplore(true); | ||
}, 500); | ||
|
||
return () => clearTimeout(timer); | ||
}, []); | ||
|
||
return ( | ||
<AnimatePresence> | ||
{loading && ( | ||
<motion.div | ||
className="flex items-center justify-center h-screen bg-primary" | ||
initial={{ opacity: 1, y: 0 }} | ||
exit={{ opacity: 0, y: -100 }} // Exit animation: fades and slides up | ||
transition={{ duration: 0.5 }} | ||
> | ||
<div className="flex flex-col items-center"> | ||
<img src={logo} alt="Logo" className="w-25" /> | ||
|
||
<div className="relative text-white text-1xl mt-0.5"> | ||
<motion.div | ||
className="relative" | ||
initial={{ opacity: 1, y: 0 }} | ||
animate={{ opacity: showExplore ? 0 : 1, y: showExplore ? -20 : 0 }} | ||
transition={{ duration: 0.25 }} | ||
> | ||
We <span className="text-secondary">Code</span> | ||
</motion.div> | ||
|
||
<motion.div | ||
className="relative" | ||
initial={{ opacity: 0, y: 20 }} | ||
animate={{ opacity: showExplore ? 1 : 0, y: showExplore ? -20 : 0 }} | ||
transition={{ duration: 0.25 }} | ||
> | ||
We <span className="text-secondary">Explore</span> | ||
</motion.div> | ||
</div> | ||
</div> | ||
</motion.div> | ||
)} | ||
</AnimatePresence> | ||
); | ||
}; | ||
|
||
export default Loader; |