-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into closes-issue-#427
- Loading branch information
Showing
4 changed files
with
112 additions
and
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,75 @@ | ||
import React from "react"; | ||
import React, { useState, useEffect } from "react"; | ||
|
||
const Preloader = () => { | ||
return( | ||
<div className="preload"> | ||
<img id="logo" src="../assets/icon/favicon.png" alt="" /> | ||
</div> | ||
) | ||
} | ||
const Preloader = () => { | ||
const [loadingPercentage, setLoadingPercentage] = useState(0); | ||
|
||
export default Preloader; | ||
useEffect(() => { | ||
const interval = setInterval(() => { | ||
setLoadingPercentage((prevPercentage) => { | ||
const newPercentage = prevPercentage + 1; | ||
if (newPercentage >= 100) { | ||
clearInterval(interval); | ||
} | ||
return newPercentage; | ||
}); | ||
}, 20); // You can adjust the interval duration to control the loading speed | ||
|
||
return () => { | ||
clearInterval(interval); | ||
}; | ||
}, []); | ||
|
||
const loaderStyle = { | ||
display: "block", | ||
position: "relative", | ||
height: "32px", | ||
width: "200px", | ||
background: "var(--extra3)", | ||
border: "2px solid #fff", | ||
overflow: "hidden", | ||
marginTop: "16px", borderRadius: "16px", | ||
|
||
|
||
}; | ||
|
||
const loaderBeforeStyle = { | ||
content: '""', | ||
background: "#0093ed", | ||
position: "absolute", | ||
left: "0", | ||
top: "0", | ||
width: `${loadingPercentage}%`, | ||
height: "100%", | ||
animation: "loading 10s linear infinite", | ||
borderRadius: "inherit", | ||
|
||
}; | ||
|
||
const loaderAfterStyle = { | ||
content: '""', | ||
position: "absolute", | ||
left: "0", | ||
top: "0", | ||
width: "100%", | ||
height: "100%", | ||
textAlign: "center", | ||
fontSize: "24px", | ||
lineHeight: "32px", | ||
color:"var(--accent-20)", | ||
mixBlendMode: "difference", | ||
animation: "percentage 10s linear infinitex " | ||
}; | ||
|
||
return ( | ||
<div className="preload"> | ||
<img id="logo" src="../assets/icon/favicon.webp" alt="" /> | ||
<span style={loaderStyle}> | ||
<span style={loaderBeforeStyle}></span> | ||
<span style={loaderAfterStyle}>{loadingPercentage}%</span> | ||
</span> | ||
|
||
</div> | ||
); | ||
}; | ||
|
||
export default Preloader; |
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