blob: a96f93eabbbb7752cb1b770016e6ca0eac4f916d (
plain)
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
|
import React from "react";
import { AlertCircle, Info } from "lucide-react";
import type { Stop } from "~/data/StopDataProvider";
import "./StopAlert.css";
interface StopAlertProps {
stop: Stop;
compact?: boolean;
}
export const StopAlert: React.FC<StopAlertProps> = ({ stop, compact = false }) => {
// Don't render anything if there's no alert content
const hasContent = stop.title || stop.message;
if (!hasContent) {
return null;
}
const isError = stop.cancelled === true;
return (
<div className={`stop-alert ${isError ? 'stop-alert-error' : 'stop-alert-info'} ${compact ? 'stop-alert-compact' : ''}`}>
{isError ? <AlertCircle /> : <Info />}
<div className="stop-alert-content">
{stop.title && <div className="stop-alert-title">{stop.title}</div>}
{stop.message && <div className="stop-alert-message">{stop.message}</div>}
</div>
</div>
);
};
|