-
Notifications
You must be signed in to change notification settings - Fork 6
/
EmptyState.tsx
57 lines (52 loc) · 1.62 KB
/
EmptyState.tsx
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
48
49
50
51
52
53
54
55
56
57
import { Button, Text } from "@bbtgnn/polaris-interfacer";
import { Close } from "@carbon/icons-react";
import Link from "next/link";
import { Link as ILink } from "./AddLink";
import Card from "./Card";
interface Props {
image?: string;
heading?: string;
icon?: React.ReactNode;
description?: string;
primaryAction?: ILink;
}
export default function EmptyState(props: Props) {
const { image, heading, description, primaryAction, icon } = props;
return (
<Card>
<div className="flex flex-col items-center justify-center space-y-6 p-8">
<div
className={`w-32 h-32 shrink-0 rounded-full flex items-center justify-center ${!image ? "bg-gray-100" : ""}`}
>
{image && <img className="w-full h-full object-cover" src={image} alt={heading} />}
{!image && (
<div className="text-text-subdued">
{/* @ts-ignore */}
{!icon && <Close size={60} />}
{icon}
</div>
)}
</div>
{(heading || description) && (
<div className="flex flex-col items-center justify-center space-y-2">
{heading && (
<Text as="h2" variant="headingLg" color="subdued">
{heading}
</Text>
)}
{description && (
<Text as="p" variant="bodyMd" color="subdued">
{description}
</Text>
)}
</div>
)}
{primaryAction && (
<Link href={primaryAction.url}>
<Button>{primaryAction.label}</Button>
</Link>
)}
</div>
</Card>
);
}