Skip to content

✨ - Updates UI loading component #45

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
Feb 12, 2025
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
6 changes: 3 additions & 3 deletions __test__/_app/Loading.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, it, describe } from 'vitest'
import { render, screen } from '@testing-library/react'
import { render } from '@testing-library/react'
import Loading from '../../src/app/loading'

describe('Loading', () => {
Expand All @@ -8,7 +8,7 @@ describe('Loading', () => {
expect(component).toBeDefined()
})
it('should display loading label', () => {
render(<Loading />)
expect(screen.getByText('Loading...')).toBeTruthy()
const { container } = render(<Loading />)
expect(container.getElementsByClassName('loader').length).toBe(1)
})
})
6 changes: 5 additions & 1 deletion src/app/loading.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
export default function Loading() {
// You can add any UI inside Loading, including a Skeleton.
return <div>Loading...</div>
return (
<div className='w-full h-[90vh] flex items-center justify-center'>
<span className='loader'></span>
</div>
)
}
34 changes: 34 additions & 0 deletions src/styles/globals.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

.loader {
width: 48px;
height: 48px;
border: 3px solid #1a1a1a;
border-radius: 50%;
display: inline-block;
position: relative;
box-sizing: border-box;
animation: rotation 1s linear infinite;
}

.loader::after {
content: '';
box-sizing: border-box;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 40px;
height: 40px;
border-radius: 50%;
border: 3px solid;
border-color: #1a1a1a transparent;
}

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