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

feat: add loader #12

Merged
merged 2 commits into from
Oct 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/components/home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ function Home({ isDark, toggleDarkMode }) {
/>
</div>
<div className="z-20 flex h-12 text-lg font-bold text-black footer dark:text-white">
Made with ❤ - by <a href="https://www.anup.tech" className="ml-2 underline"> Anup</a>
Made with ❤ - by{' '}
<a href="https://www.anup.tech" className="ml-2 underline">
{' '}
Anup
</a>
</div>
</div>
</div>
Expand Down
19 changes: 19 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
/>
<meta property="twitter:image" content="./assets/bg.png" />
<link rel="shortcut icon" href="./assets/3-01.svg" />
<link rel="stylesheet" href="/styles/loader.css" />

<!-- Global site tag (gtag.js) - Google Analytics -->
<script
Expand All @@ -60,5 +61,23 @@
</head>
<body>
<div id="app"></div>
<div class="loader-container">
<div class="loader"></div>
</div>
</body>

<script>
document.onreadystatechange = function () {
const state = document.readyState
if (state === 'interactive') {
document.querySelector('#app').style.display = 'none'
} else if (state === 'complete') {
// setTimeout can be used to test the loader.
// setTimeout(function () {
document.querySelector('.loader-container').style.display = 'none'
document.querySelector('#app').style.display = 'block'
// }, 3000)
}
}
</script>
</html>
56 changes: 56 additions & 0 deletions src/styles/loader.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
.loader-container {
width: 100%;
height: 100vh;
background-color: #eee;
display: flex;
justify-content: center;
align-items: center;
}

.loader {
width: 100px;
height: 100px;
background-color: #4de6d4;
border-radius: 50%;
position: relative;
overflow: hidden;
}

.loader:after {
content: '';
position: absolute;
width: 100px;
height: 100px;
background-color: #fff;
}

.loader:before {
content: '';
position: absolute;
width: 100px;
height: 100px;
background-color: #fff;
}

.loader:before {
top: -40px;
border-radius: 50%;
background: rgba(255, 255, 255, 0.7);
animation: wave 5s linear infinite;
}

.loader:after {
top: -40px;
border-radius: 30%;
background: rgba(255, 255, 255, 0.3);
animation: wave 5s linear infinite;
}

@keyframes wave {
0% {
transform: rotate(0);
}
100% {
transform: rotate(360deg);
}
}