Skip to content
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

fix(spinner): center spinner and enhance design #879

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 34 additions & 16 deletions components/UI/MainLoader.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from "react";
import { FaSpinner } from "react-icons/fa";

const MainLoader = () => {
return (
Expand All @@ -10,7 +11,7 @@ const MainLoader = () => {
<div style={styles.newPreloaderCircle}></div>
<div style={styles.newPreloaderImg}>
<div style={styles.newImgWrapper}>
<img src="faviconn.png" alt="Loading" style={styles.newImg} />
<FaSpinner style={styles.spinnerIcon} />
</div>
</div>
</div>
Expand All @@ -22,15 +23,21 @@ const MainLoader = () => {

const styles = {
newPreloaderContainer: {
position: "relative",
position: "fixed",
top: 0,
left: 0,
width: "100%",
height: "100%",
backgroundColor: "rgba(0, 0, 0, 0.5)",
zIndex: 1000,
},
newLoaderBackground: {
// Add necessary styles for new loader background
position: "absolute",
width: "100%",
height: "100%",
backgroundColor: "transparent",
},
newPreloaderActive: {
transition: "all 0.5s",
display: "flex",
alignItems: "center",
justifyContent: "center",
Expand All @@ -48,30 +55,41 @@ const styles = {
position: "relative",
},
newPreloaderCircle: {
width: "80px",
height: "80px",
width: "100px",
height: "100px",
border: "5px solid #f0f0f0",
borderTop: "5px solid purple",
borderTop: "5px solid #6a0dad",
borderRadius: "50%",
animation: "spin 1s linear infinite",
},
newPreloaderImg: {
position: "absolute",
},
newImgWrapper: {
backgroundColor: "white",
width: "80px",
height: "80px",
borderRadius: "50%",
display: "flex",
alignItems: "center",
justifyContent: "center",
position: "absolute",
top: "0",
left: "0",
width: "100%",
height: "100%",
},
newImg: {
width: "55px",
height: "55px",
borderRadius: "50%",
spinnerIcon: {
fontSize: "50px",
color: "#6a0dad",
animation: "spin 1.5s linear infinite",
},
};

export default MainLoader;
const spinAnimation = `
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
`;

const styleSheet = document.styleSheets[0];
styleSheet.insertRule(spinAnimation, styleSheet.cssRules.length);

export default MainLoader;
Loading