forked from Dshield-xyz/Dshield
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPage.tsx
More file actions
84 lines (80 loc) · 1.91 KB
/
Copy pathPage.tsx
File metadata and controls
84 lines (80 loc) · 1.91 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
"use client";
import { cn } from "@/lib/cn";
import { Card } from "./Card";
import { Button } from "./Button";
import { useWallet } from "@/components/WalletProvider";
/**
* Centered page container. `width` matches the two layouts in the app: the
* narrow flow pages (deposit/withdraw/compliance/history) and the wide
* marketing/home layout.
*/
export function PageShell({
width = "narrow",
className,
children,
}: {
width?: "narrow" | "wide";
className?: string;
children: React.ReactNode;
}) {
return (
<div
className={cn(
"mx-auto px-4 py-10 sm:px-6 sm:py-16",
width === "narrow" ? "max-w-2xl" : "max-w-5xl",
className,
)}
>
{children}
</div>
);
}
/** Page title + optional supporting paragraph. */
export function PageHeader({
title,
description,
}: {
title: string;
description?: React.ReactNode;
}) {
return (
<div>
<h1 className="text-2xl font-bold tracking-tight">{title}</h1>
{description && (
<p className="mt-2 text-sm leading-relaxed text-zinc-400">
{description}
</p>
)}
</div>
);
}
/**
* The "connect your wallet" empty state shown by every gated page. Renders the
* page title plus a centered prompt card with the connect action inline, so
* the user never has to hunt for the button in the header.
*/
export function ConnectGate({
title,
prompt,
}: {
title: string;
prompt: string;
}) {
const { connect, isConnecting } = useWallet();
return (
<PageShell>
<h1 className="text-2xl font-bold tracking-tight">{title}</h1>
<Card className="mt-6 p-8 text-center">
<p className="text-zinc-400">{prompt}</p>
<Button
size="lg"
className="mt-6"
onClick={connect}
disabled={isConnecting}
>
{isConnecting ? "Connecting..." : "Connect Wallet"}
</Button>
</Card>
</PageShell>
);
}