forked from koshikraj/ottopus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathempty-state.tsx
More file actions
48 lines (46 loc) · 1.25 KB
/
Copy pathempty-state.tsx
File metadata and controls
48 lines (46 loc) · 1.25 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
48
import type { ReactNode } from 'react'
import { cn } from '@/lib/cn'
export interface EmptyStateProps {
title: string
description?: string
/** Otto drifting, once the mascot lands in #48. A 150px square slot. */
illustration?: ReactNode
action?: ReactNode
className?: string
}
/**
* An empty state is an invitation, not an apology. It names the space, explains
* it in one line, and offers the verb that fills it.
*
* The description is capped at 30ch because a centred paragraph wider than that
* stops being scannable.
*/
export function EmptyState({
title,
description,
illustration,
action,
className,
}: EmptyStateProps) {
return (
<div
className={cn(
'flex flex-col items-center gap-3 rounded-[var(--ot-radius-md)] px-6 py-8 text-center',
className,
)}
>
{illustration ? (
<div aria-hidden className="h-[150px] w-[150px]">
{illustration}
</div>
) : null}
<p className="font-display text-[20px] font-bold">{title}</p>
{description ? (
<p className="max-w-[30ch] text-[14px] leading-[1.5] text-[var(--ot-text-2)]">
{description}
</p>
) : null}
{action ? <div className="mt-1">{action}</div> : null}
</div>
)
}