Skip to content

Commit

Permalink
[FE][Feat] #274 : 지도 가져올 때 로딩 화면 추가 (로딩 스피너로 대체)
Browse files Browse the repository at this point in the history
- 지도 가져올 때 로딩 화면 추가 (로딩 스피너로 대체)
- 홈 화면에서 지도 로딩 화면 적용
  • Loading branch information
happyhyep committed Nov 26, 2024
1 parent d2f952d commit 8db2c6c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
19 changes: 19 additions & 0 deletions frontend/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,22 @@
-ms-user-select:none;
user-select:none
}

.spinner {
width: 3rem;
height: 3rem;
border: 0.5rem solid rgba(0, 0, 0, 0.1);
border-top: 0.5rem solid #1c58b3;
border-radius: 50%;
animation: spin 1s linear infinite;
margin-bottom: 10px;
}

@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const LoadingSpinner = () => {
return <div className="spinner" />;
};
9 changes: 6 additions & 3 deletions frontend/src/pages/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { AppConfig } from '@/lib/constants/commonConstants.ts';
import { v4 as uuidv4 } from 'uuid';
import { getUserLocation } from '@/hooks/getUserLocation.ts';
import { MapCanvasForView } from '@/component/canvasWithMap/canvasWithMapForView/MapCanvasForView.tsx';
import { LoadingSpinner } from '@/component/common/loadingSpinner/LoadingSpinner.tsx';

const contentData = [
{
Expand Down Expand Up @@ -103,13 +104,15 @@ export const Main = () => {
otherLocations={otherLocations}
/>
) : (
<section className="flex h-full items-center justify-center">
<section className="flex h-full flex-col items-center justify-center gap-2 text-xl text-gray-700">
<LoadingSpinner />
Loading map data...
</section>
)
) : (
<section className="flex h-full items-center justify-center">
{error ? `Error: ${error}` : 'Loading'}
<section className="flex h-full flex-col items-center justify-center gap-2 text-xl text-gray-700">
<LoadingSpinner />
{error ? `Error: ${error}` : 'Loading map data...'}
</section>
)}
</main>
Expand Down

0 comments on commit 8db2c6c

Please sign in to comment.