morethanadiagnosis-hub/web/components/ui/ErrorState.tsx

23 lines
842 B
TypeScript

import React from 'react'
import { Button } from '../common/Button'
import { ExclamationTriangleIcon } from '@heroicons/react/24/outline'
interface ErrorStateProps {
message?: string
onRetry?: () => void
}
export function ErrorState({ message = 'Something went wrong.', onRetry }: ErrorStateProps) {
return (
<div className="flex flex-col items-center justify-center py-12 text-center">
<ExclamationTriangleIcon className="h-12 w-12 text-red-500 mb-4" />
<p className="text-gray-900 dark:text-white font-medium mb-2">Error</p>
<p className="text-gray-500 dark:text-gray-400 mb-6 max-w-md">{message}</p>
{onRetry && (
<Button onClick={onRetry} variant="primary">
Try Again
</Button>
)}
</div>
)
}