5.3 글로벌 로딩/스켈레톤/에러 경계 패턴 정립 o
This commit is contained in:
19
src/app/components/ui/Skeleton.tsx
Normal file
19
src/app/components/ui/Skeleton.tsx
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
export function Skeleton({ width = "100%", height = 16 }: { width?: number | string; height?: number | string }) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
borderRadius: 6,
|
||||||
|
background:
|
||||||
|
"linear-gradient(90deg, #eee 25%, #f5f5f5 37%, #eee 63%)",
|
||||||
|
backgroundSize: "400% 100%",
|
||||||
|
animation: "shine 1.2s ease-in-out infinite",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<style>{`@keyframes shine{0%{background-position:100% 0}100%{background-position:0 0}}`}</style>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
17
src/app/error.tsx
Normal file
17
src/app/error.tsx
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
"use client";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
|
||||||
|
export default function GlobalError({ error, reset }: { error: Error & { digest?: string }; reset: () => void }) {
|
||||||
|
useEffect(() => {
|
||||||
|
console.error(error);
|
||||||
|
}, [error]);
|
||||||
|
return (
|
||||||
|
<div style={{ padding: 24 }}>
|
||||||
|
<h2>문제가 발생했습니다.</h2>
|
||||||
|
<p>{error.message}</p>
|
||||||
|
<button onClick={() => reset()}>다시 시도</button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
18
src/app/loading.tsx
Normal file
18
src/app/loading.tsx
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
export default function Loading() {
|
||||||
|
return (
|
||||||
|
<div style={{ padding: 24 }}>
|
||||||
|
<div style={{
|
||||||
|
width: 48,
|
||||||
|
height: 48,
|
||||||
|
borderRadius: "50%",
|
||||||
|
border: "4px solid #eee",
|
||||||
|
borderTopColor: "#111",
|
||||||
|
animation: "spin 1s linear infinite",
|
||||||
|
margin: "24px auto",
|
||||||
|
}} />
|
||||||
|
<style>{`@keyframes spin{to{transform:rotate(360deg)}}`}</style>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
[공통/레이아웃]
|
[공통/레이아웃]
|
||||||
5.1 앱 레이아웃/헤더/푸터/사이드바 구성 o
|
5.1 앱 레이아웃/헤더/푸터/사이드바 구성 o
|
||||||
5.2 공통 컴포넌트(버튼/입력/모달/토스트) 제작 o
|
5.2 공통 컴포넌트(버튼/입력/모달/토스트) 제작 o
|
||||||
5.3 글로벌 로딩/스켈레톤/에러 경계 패턴 정립
|
5.3 글로벌 로딩/스켈레톤/에러 경계 패턴 정립 o
|
||||||
5.4 테마/다크모드 및 반응형 설정
|
5.4 테마/다크모드 및 반응형 설정
|
||||||
|
|
||||||
[메인 화면]
|
[메인 화면]
|
||||||
|
|||||||
Reference in New Issue
Block a user