-
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.
Merge pull request #2 from chiraag918/development
DEV to PROD Deployment: Imporvements
- Loading branch information
Showing
7 changed files
with
88 additions
and
31 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
.loader-container{ | ||
display: flex; | ||
width:100vw; | ||
height: 100vh; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.spin{ | ||
width:6vw; | ||
height:6vw; | ||
border-radius:50%; | ||
box-shadow: 2px 2px 8px white, | ||
4px 4px 8px #fff; | ||
border:10px solid #fff; | ||
border-bottom:10px solid transparent; | ||
border-top:10px solid transparent; | ||
animation: spin 1.4s linear infinite; | ||
} | ||
|
||
@keyframes spin{ | ||
0%{ | ||
transform: rotate(0deg); | ||
} | ||
100%{ | ||
transform: rotate(-360deg); | ||
} | ||
} |
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,11 @@ | ||
import "./CircularLoader.css"; | ||
|
||
const CircularLoader = () => { | ||
return ( | ||
<div class="loader-container"> | ||
<div class="spin"></div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default CircularLoader; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ body { | |
|
||
iframe{ | ||
border: none; | ||
overflow: scroll; | ||
} | ||
|
||
.container { | ||
|
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,30 @@ | ||
import { useEffect, useState } from "react"; | ||
import CircularLoader from "../components/CircularLoader"; | ||
|
||
const ImagePreloader = ({ images, children }) => { | ||
const [isLoading, setIsLoading] = useState(true); | ||
|
||
useEffect(() => { | ||
const imagePromises = images.map((src) => { | ||
return new Promise((resolve, reject) => { | ||
const img = new Image(); | ||
img.src = src; | ||
img.onload = resolve; | ||
img.onerror = reject; | ||
}); | ||
}); | ||
|
||
Promise.all(imagePromises) | ||
.then(() => { | ||
setIsLoading(false); | ||
}) | ||
.catch((error) => { | ||
console.error("Error preloading images:", error); | ||
setIsLoading(false); | ||
}); | ||
}, [images]); | ||
|
||
return isLoading ? <CircularLoader /> : children; | ||
}; | ||
|
||
export default ImagePreloader; |