Skip to content

Commit

Permalink
Added a preloader to website
Browse files Browse the repository at this point in the history
  • Loading branch information
dhairyagothi committed Jun 12, 2024
1 parent df5abf7 commit f2a9025
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 3 deletions.
47 changes: 47 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,58 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<style>


*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
.loading {
-webkit-animation: sk-scaleout 1s infinite ease-in-out;
animation: sk-scaleout 1s infinite ease-in-out;
background-color: rgb(22, 110, 233);
border-radius: 100%;
height: 6em;
width: 6em;

}

.container {
margin: 0;
padding: 0;
background-color: none;
height: 100vh;
width: 100vw;
display: flex;
justify-content: center;
align-items: center;

}

@keyframes sk-scaleout {
0% {
-webkit-transform: scale(0);
transform: scale(0);
}
100% {
-webkit-transform: scale(1);
opacity: 0.5;
transform: scale(1);
}
}
</style>

<title>75%.Com</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>

<div id="spinner" class="container">
<div class="loading"></div>
</div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
Expand Down
14 changes: 11 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,16 @@ function App() {
// const toggleTheme = () => {
// setTheme((curr) => (curr === "light" ? "light ": "dark"));
// }


return (
const [loading, setLoading] = useState(true);
const spinner = document.getElementById("spinner");
if (spinner) {
setTimeout(() => {
spinner.style.display = "none";
setLoading(false);
}, 2000);
}
return(
!loading &&(
<div className="maintain">

{/* <ThemeContext.Provider value={{theme, toggleTheme}}> */}
Expand All @@ -36,6 +43,7 @@ function App() {

</div>
)
)
}

export default App

0 comments on commit f2a9025

Please sign in to comment.