Skip to content

Commit

Permalink
Merge pull request #365 from Jagpreet153/main
Browse files Browse the repository at this point in the history
Added preloader
  • Loading branch information
Priyaaa1 authored Jun 3, 2024
2 parents 75b2e17 + ba6050a commit f020c6f
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 2 deletions.
18 changes: 18 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"aos": "^2.3.4",
"bootstrap": "^5.3.3",
"jwt-decode": "^4.0.0",
"lottie-react": "^2.4.0",
"react": "^18.2.0",
"react-bootstrap": "^2.10.2",
"react-chatbot-kit": "^2.2.2",
Expand Down
12 changes: 12 additions & 0 deletions src/Components/Preloader/Preloader.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.pre{
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 37%;
left: 47%;
width: 10vw;
height: 10vh;
}


30 changes: 30 additions & 0 deletions src/Components/Preloader/Preloader.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React,{useEffect,useState} from "react";
import pre from '../../assets/pre.json';
import './Preloader.css'
import Lottie from 'lottie-react';
import App from '../../App';
export default function Preloader() {
const [loading,setLoading]=useState(false);
useEffect(()=>{
setLoading(true);
setTimeout(() =>{
setLoading(false)
},2000)
},[])
return (
<div>
{
loading ?
<div>
<div className='pre'>
<div className="preloader"><Lottie animationData={pre}/></div>
</div>
</div>
:
//Rest Code
<App/>
}

</div>
)
}
1 change: 1 addition & 0 deletions src/assets/pre.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/main.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App.jsx'
import './index.css'
import Preloader from './Components/Preloader/Preloader.jsx'
import { GoogleOAuthProvider } from '@react-oauth/google'

ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode>
<GoogleOAuthProvider clientId="1039349867829-5mc9jupnfc21969mbsk1pf4vgovafdhg.apps.googleusercontent.com">
<App />
<Preloader/>
</GoogleOAuthProvider>

</React.StrictMode>,
Expand Down

0 comments on commit f020c6f

Please sign in to comment.