1.8 KB79 lines
Blame
1import Link from "next/link";
2
3export interface EmptyStateProps {
4 icon?: React.ReactNode;
5 title: string;
6 description?: string;
7 action?: {
8 label: string;
9 href?: string;
10 onClick?: () => void;
11 };
12 className?: string;
13}
14
15export function EmptyState({
16 icon,
17 title,
18 description,
19 action,
20 className = "",
21}: EmptyStateProps) {
22 return (
23 <div
24 className={`py-12 text-center ${className}`}
25 style={{
26 backgroundColor: "var(--bg-card)",
27 border: "1px solid var(--border-subtle)",
28 }}
29 >
30 {icon && (
31 <div className="flex justify-center mb-4" style={{ opacity: 0.4 }}>
32 {icon}
33 </div>
34 )}
35 <p className="text-sm" style={{ color: "var(--text-secondary)" }}>
36 {title}
37 </p>
38 {description && (
39 <p
40 className="text-xs mt-1"
41 style={{ color: "var(--text-faint)" }}
42 >
43 {description}
44 </p>
45 )}
46 {action && (
47 <div className="mt-4">
48 {action.href ? (
49 <Link
50 href={action.href}
51 className="text-sm px-3 py-1.5 inline-block"
52 style={{
53 backgroundColor: "var(--accent)",
54 color: "var(--accent-text)",
55 }}
56 >
57 {action.label}
58 </Link>
59 ) : (
60 <button
61 onClick={action.onClick}
62 className="text-sm px-3 py-1.5"
63 style={{
64 backgroundColor: "var(--accent)",
65 color: "var(--accent-text)",
66 cursor: "pointer",
67 font: "inherit",
68 border: "none",
69 }}
70 >
71 {action.label}
72 </button>
73 )}
74 </div>
75 )}
76 </div>
77 );
78}
79