Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 1m43s
34 lines
997 B
React
34 lines
997 B
React
import { IconAlertTriangle, IconX } from '@tabler/icons-react';
|
|
|
|
function ErrorAlert({ message, details, onClose }) {
|
|
if (!message) return null;
|
|
return (
|
|
<div className="alert alert-danger alert-dismissible" role="alert">
|
|
<div className="d-flex">
|
|
<div>
|
|
<IconAlertTriangle className="icon alert-icon" />
|
|
</div>
|
|
<div className="flex-grow-1">
|
|
{String(message)}
|
|
{details ? (
|
|
<details className="small mt-1">
|
|
<summary>Показать детали</summary>
|
|
<pre className="mb-0 mt-1" style={{ whiteSpace: 'pre-wrap' }}>
|
|
{typeof details === 'string' ? details : JSON.stringify(details, null, 2)}
|
|
</pre>
|
|
</details>
|
|
) : null}
|
|
</div>
|
|
</div>
|
|
<button type="button" className="btn-close" onClick={onClose} aria-label="Закрыть">
|
|
<IconX size={16} />
|
|
</button>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default ErrorAlert;
|
|
|
|
|
|
|