forked from commitra/react-verse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathErrorMessage.jsx
More file actions
31 lines (29 loc) · 772 Bytes
/
ErrorMessage.jsx
File metadata and controls
31 lines (29 loc) · 772 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
export default function ErrorMessage({ error, message, onRetry }) {
if (!error && !message) return null;
const displayMessage = message || error?.toString() || 'An error occurred';
return (
<div className="error">
<div className="error-message">
❌ {displayMessage}
</div>
{onRetry && (
<button
className="retry-button"
onClick={onRetry}
style={{
marginTop: '10px',
padding: '8px 16px',
backgroundColor: '#007acc',
color: 'white',
border: 'none',
borderRadius: '4px',
cursor: 'pointer',
fontSize: '14px'
}}
>
🔄 Retry
</button>
)}
</div>
);
}