Skip to content

Add loading page #2

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

Merged
merged 3 commits into from
Dec 2, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions overload/src/app/components/coursesList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ type Term = {
};

export const CoursesList = async () => {
//imitate delay
await new Promise(resolve => setTimeout(resolve, 3000));

const res = await fetch('http://localhost:3000/api/home', {
cache: 'no-store',
});
Expand Down
21 changes: 21 additions & 0 deletions overload/src/app/loading.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@keyframes bounce {
0%, 100% {
transform: translateY(0);
}
50% {
transform: translateY(-20px);
}
}

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

.animate-spin {
animation: spin 2s linear infinite;
}
13 changes: 13 additions & 0 deletions overload/src/app/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import './loading.css'
import skullSvg from './resources/skull-head-svgrepo-com.svg';
import Image from 'next/image'

export default function Loading() {
return (
<div className="min-h-screen flex justify-center items-center flex-col">
<div className="w-1/4 h-1/4">
<Image src={skullSvg} alt="OverLoad" className="animate-spin colored-svg" layout="responsive"/>
</div>
</div>
)
}
2 changes: 2 additions & 0 deletions overload/src/app/resources/skull-head-svgrepo-com.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.