-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added preloader. #436
Added preloader. #436
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks great, just have one suggestion: instead of alternating between white and black colors in the preloader we can first show white then show black bg, and stop there. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As animation have also been added to the incoming text so that would not look good ,i tried it out. It just looks like a glitch. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok then we can go ahead with this |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import { motion } from 'framer-motion'; | ||
|
||
const PreLoader: React.FC = () => { | ||
const [isWhite, setIsWhite] = useState<boolean>(true); | ||
|
||
useEffect(() => { | ||
const interval = setInterval(() => { | ||
setIsWhite((prev) => !prev); | ||
}, 500); | ||
|
||
return () => clearInterval(interval); | ||
}, []); | ||
|
||
return ( | ||
<motion.div | ||
animate={{ | ||
color: isWhite ? 'black' : 'white', | ||
backgroundColor: isWhite ? 'white' : 'black', | ||
}} | ||
transition={{ type: 'spring', stiffness: 15 }} | ||
className="w-full h-svh overflow-hidden flex justify-center items-center transition ease-out duration-500" | ||
> | ||
<motion.div | ||
initial={{ scale: 3 }} | ||
animate={{ scale: 1 }} | ||
transition={{ duration: 1.8, delay: 0.1, type: 'spring', stiffness: 30 }} | ||
className="xl:text-5xl text-xl sm:text-2xl md:text-3xl lg:text-6xl uppercase font-extrabold font-sans" | ||
> | ||
<p>Welcome to StyleShare</p> | ||
</motion.div> | ||
</motion.div> | ||
); | ||
}; | ||
|
||
export default PreLoader; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,13 @@ import ReactDOM from 'react-dom/client' | |
import App from './App.tsx' | ||
import { RecoilRoot } from "recoil"; | ||
import './index.css' | ||
// import PreLoader from './components/Loader/Loader'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove commented code |
||
|
||
ReactDOM.createRoot(document.getElementById('root')!).render( | ||
<React.StrictMode> | ||
{/* <PreLoader /> */} | ||
<RecoilRoot> | ||
|
||
<App /> | ||
</RecoilRoot> | ||
</React.StrictMode>, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable is not in react naming convention
Similar to https://react.dev/reference/react/useState#setstate