forked from
slices.network/slices
Highly ambitious ATProtocol AppView service and sdks
1import { Card } from "./Card.tsx";
2import { Text } from "./Text.tsx";
3import { CheckCircle2, XCircle } from "lucide-preact";
4
5interface FlashMessageProps {
6 type: "success" | "error";
7 message: string;
8 className?: string;
9}
10
11export function FlashMessage(
12 { type, message, className = "" }: FlashMessageProps,
13) {
14 if (type === "success") {
15 return (
16 <Card padding="sm" className={`mb-4 bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800 ${className}`}>
17 <div className="flex items-center gap-3">
18 <CheckCircle2
19 size={20}
20 className="flex-shrink-0"
21 style={{ fill: '#16a34a', stroke: 'white', strokeWidth: 1 }}
22 />
23 <Text variant="success" className="flex-1">
24 {message}
25 </Text>
26 </div>
27 </Card>
28 );
29 }
30
31 return (
32 <Card padding="sm" className={`mb-4 bg-red-50 dark:bg-red-900/20 border-red-200 dark:border-red-800 ${className}`}>
33 <div className="flex items-center gap-3">
34 <XCircle
35 size={20}
36 className="flex-shrink-0"
37 style={{ fill: '#dc2626', stroke: 'white', strokeWidth: 1 }}
38 />
39 <Text variant="error" className="flex-1">
40 {message}
41 </Text>
42 </div>
43 </Card>
44 );
45}