forked from PinSpace-Org/GistPin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmptyState.tsx
More file actions
47 lines (42 loc) · 1.16 KB
/
Copy pathEmptyState.tsx
File metadata and controls
47 lines (42 loc) · 1.16 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
'use client';
import { ReactNode } from 'react';
type Variant = 'default' | 'search' | 'error' | 'empty';
interface EmptyStateProps {
title: string;
description?: string;
icon?: ReactNode;
action?: ReactNode;
variant?: Variant;
className?: string;
}
const defaultIcons: Record<Variant, string> = {
default: '📭',
search: '🔍',
error: '⚠️',
empty: '🗂️',
};
export default function EmptyState({
title,
description,
icon,
action,
variant = 'default',
className = '',
}: EmptyStateProps) {
return (
<div
className={`flex flex-col items-center justify-center gap-3 rounded-xl border border-dashed border-gray-200 bg-gray-50 px-6 py-12 text-center dark:border-gray-700 dark:bg-gray-800/30 ${className}`}
>
<span className="text-4xl" aria-hidden="true">
{icon ?? defaultIcons[variant]}
</span>
<div>
<p className="text-sm font-semibold text-gray-800 dark:text-gray-200">{title}</p>
{description && (
<p className="mt-1 text-xs text-gray-500 dark:text-gray-400">{description}</p>
)}
</div>
{action && <div className="mt-1">{action}</div>}
</div>
);
}