2025-11-23 16:10:27 +09:00
|
|
|
// 로딩 스피너 컴포넌트
|
|
|
|
|
// API 호출 중 로딩 상태 표시용
|
2025-11-28 15:25:33 +09:00
|
|
|
// 대시보드 스타일로 통일 (border-4 border-solid border-primary border-r-transparent)
|
2025-11-23 16:10:27 +09:00
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
|
|
interface LoadingSpinnerProps {
|
|
|
|
|
size?: 'sm' | 'md' | 'lg';
|
|
|
|
|
className?: string;
|
|
|
|
|
text?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const LoadingSpinner: React.FC<LoadingSpinnerProps> = ({
|
|
|
|
|
size = 'md',
|
|
|
|
|
className = '',
|
|
|
|
|
text
|
|
|
|
|
}) => {
|
|
|
|
|
const sizeClasses = {
|
2025-11-28 15:25:33 +09:00
|
|
|
sm: 'h-4 w-4 border-2',
|
|
|
|
|
md: 'h-8 w-8 border-4',
|
|
|
|
|
lg: 'h-12 w-12 border-4'
|
2025-11-23 16:10:27 +09:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className={`flex flex-col items-center justify-center gap-2 ${className}`}>
|
2025-11-28 15:25:33 +09:00
|
|
|
<div className={`animate-spin rounded-full border-solid border-primary border-r-transparent ${sizeClasses[size]}`} />
|
2025-11-23 16:10:27 +09:00
|
|
|
{text && <p className="text-sm text-muted-foreground">{text}</p>}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2025-11-28 15:25:33 +09:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 페이지 레벨 로딩 스피너 (전체 화면 중앙 배치)
|
|
|
|
|
interface PageLoadingSpinnerProps {
|
|
|
|
|
text?: string;
|
|
|
|
|
minHeight?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const PageLoadingSpinner: React.FC<PageLoadingSpinnerProps> = ({
|
|
|
|
|
text = '불러오는 중...',
|
|
|
|
|
minHeight = 'min-h-[60vh]'
|
|
|
|
|
}) => {
|
|
|
|
|
return (
|
|
|
|
|
<div className={`flex items-center justify-center ${minHeight}`}>
|
|
|
|
|
<div className="text-center space-y-4">
|
|
|
|
|
<div className="inline-block h-12 w-12 animate-spin rounded-full border-4 border-solid border-primary border-r-transparent"></div>
|
|
|
|
|
<p className="text-muted-foreground font-medium">{text}</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2025-11-23 16:10:27 +09:00
|
|
|
};
|