Files
sam-react-prod/src/components/ui/error-message.tsx

38 lines
946 B
TypeScript
Raw Normal View History

// 에러 메시지 컴포넌트
// API 오류 메시지 일관된 UI로 표시
import React from 'react';
import { AlertCircle } from 'lucide-react';
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';
interface ErrorMessageProps {
title?: string;
message: string;
onRetry?: () => void;
className?: string;
}
export const ErrorMessage: React.FC<ErrorMessageProps> = ({
title = '오류 발생',
message,
onRetry,
className = ''
}) => {
return (
<Alert variant="destructive" className={className}>
<AlertCircle className="h-4 w-4" />
<AlertTitle>{title}</AlertTitle>
<AlertDescription className="mt-2">
<p>{message}</p>
{onRetry && (
<button
onClick={onRetry}
className="mt-2 text-sm underline hover:no-underline"
>
</button>
)}
</AlertDescription>
</Alert>
);
};