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: Added loader! #54

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 4 additions & 2 deletions app/about/page.jsx
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Loader for the home page only.

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import Navbar from "@/components/Navbar";
import Footer from "@/components/Footer";
import backgroundImg from "@/public/background.webp";
import { Button } from "@/components/ui/button";
import Loading from "@/components/Loader";
import { Suspense } from "react";

export default function About() {
const [email, setEmail] = useState("");
Expand Down Expand Up @@ -52,7 +54,7 @@ export default function About() {
};

return (
<>
<Suspense fallback={<Loading />}>
<div className="relative flex flex-col justify-around w-full min-h-screen">
<ToastContainer />
<Image
Expand Down Expand Up @@ -488,6 +490,6 @@ export default function About() {
</div>
</div>
<Footer />
</>
</Suspense>
);
}
4 changes: 4 additions & 0 deletions app/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ import { Button } from "@/components/ui/button";
import { ArrowTopRightIcon } from "@radix-ui/react-icons";
import hackbyteLogo from "@/public/hackbyteLogo.png";
import Image from "next/image";
import Loading from "@/components/Loader";
import { Suspense } from "react";

export default function Home() {
return (
<Suspense fallback={<Loading />}>
<div
className="flex flex-col justify-around min-h-screen
bg-cover bg-no-repeat p-4 md:px-12 md:py-8"
Expand Down Expand Up @@ -114,5 +117,6 @@ export default function Home() {
</div>
</div>
</div>
</Suspense>
);
}
19 changes: 19 additions & 0 deletions components/Loader/index.jsx
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Utilize Tailwind CSS wherever possible, avoiding the use of plain CSS.

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import styles from "./index.module.css";
const Loading = () => {
return (
<div className={styles.body}>
<div className={styles.container}>
<div className={styles.load}>
<div>G</div>
<div>N</div>
<div>I</div>
<div>D</div>
<div>A</div>
<div>O</div>
<div>L</div>
</div>
</div>
</div>
);
};
export default Loading;
192 changes: 192 additions & 0 deletions components/Loader/index.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
.body {
background-color: black;
height: 100vh;
}

.container {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}

.container .load {
position: absolute;
width: 600px;
height: 36px;
left: 50%;
top: 40%;
margin-left: -300px;
overflow: visible;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: default;
}

.container .load div {
position: absolute;
width: 48px;
height: 56px;
opacity: 0;
font-weight: 600;
font-family: Helvetica, Arial, sans-serif;
animation: move 2s linear infinite;
-o-animation: move 2s linear infinite;
-moz-animation: move 2s linear infinite;
-webkit-animation: move 2s linear infinite;
transform: rotate(180deg);
-o-transform: rotate(180deg);
-moz-transform: rotate(180deg);
-webkit-transform: rotate(180deg);
color: #006eff;
}

.container .load div:nth-child(2) {
animation-delay: 0.2s;
-o-animation-delay: 0.2s;
-moz-animation-delay: 0.2s;
-webkit-animation-delay: 0.2s;
}

.container .load div:nth-child(3) {
animation-delay: 0.4s;
-o-animation-delay: 0.4s;
-webkit-animation-delay: 0.4s;
-webkit-animation-delay: 0.4s;
}

.container .load div:nth-child(4) {
animation-delay: 0.6s;
-o-animation-delay: 0.6s;
-moz-animation-delay: 0.6s;
-webkit-animation-delay: 0.6s;
}

.container .load div:nth-child(5) {
animation-delay: 0.8s;
-o-animation-delay: 0.8s;
-moz-animation-delay: 0.8s;
-webkit-animation-delay: 0.8s;
}

.container .load div:nth-child(6) {
animation-delay: 1s;
-o-animation-delay: 1s;
-moz-animation-delay: 1s;
-webkit-animation-delay: 1s;
}

.container .load div:nth-child(7) {
animation-delay: 1.2s;
-o-animation-delay: 1.2s;
-moz-animation-delay: 1.2s;
-webkit-animation-delay: 1.2s;
}

@keyframes move {
0% {
left: 0;
opacity: 0;
}
35% {
left: 41%;
-moz-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
opacity: 1;
}
65% {
left: 59%;
-moz-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
opacity: 1;
}
100% {
left: 100%;
-moz-transform: rotate(-180deg);
-webkit-transform: rotate(-180deg);
-o-transform: rotate(-180deg);
transform: rotate(-180deg);
opacity: 0;
}
}

@-moz-keyframes move {
0% {
left: 0;
opacity: 0;
}
35% {
left: 41%;
-moz-transform: rotate(0deg);
transform: rotate(0deg);
opacity: 1;
}
65% {
left: 59%;
-moz-transform: rotate(0deg);
transform: rotate(0deg);
opacity: 1;
}
100% {
left: 100%;
-moz-transform: rotate(-180deg);
transform: rotate(-180deg);
opacity: 0;
}
}

@-webkit-keyframes move {
0% {
left: 0;
opacity: 0;
}
35% {
left: 41%;
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
opacity: 1;
}
65% {
left: 59%;
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
opacity: 1;
}
100% {
left: 100%;
-webkit-transform: rotate(-180deg);
transform: rotate(-180deg);
opacity: 0;
}
}

@-o-keyframes move {
0% {
left: 0;
opacity: 0;
}
35% {
left: 41%;
-o-transform: rotate(0deg);
transform: rotate(0deg);
opacity: 1;
}
65% {
left: 59%;
-o-transform: rotate(0deg);
transform: rotate(0deg);
opacity: 1;
}
100% {
left: 100%;
-o-transform: rotate(-180deg);
transform: rotate(-180deg);
opacity: 0;
}
}