Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

ClerkUserProfilePage.tsx

86 lines2.2 KB

1import { RefreshCwIcon } from "lucide-react";
2import type { ReactNode } from "react";
3​
4import { cn } from "../../lib/utils";
5import { Button } from "../ui/button";
6​
7export function ClerkUserProfilePage({
8 action,
9 children,
10 className,
11 description,
12 title,
13}: {
14 readonly action?: ReactNode;
15 readonly children: ReactNode;
16 readonly className?: string;
17 readonly description?: ReactNode;
18 readonly title: ReactNode;
19}) {
20 return (
21 <div className={cn("w-full min-w-0 text-foreground", className)}>
22 <header className="flex flex-col gap-3 pb-4 sm:flex-row sm:items-start sm:justify-between sm:gap-4 sm:pr-8">
23 <div className="min-w-0">
24 <h2 className="text-[1.0625rem] leading-6 font-semibold">{title}</h2>
25 {description ? (
26 <p className="mt-1 max-w-[34rem] text-[0.8125rem] leading-[1.125rem] text-muted-foreground sm:min-h-9">
27 {description}
28 </p>
29 ) : null}
30 </div>
31 {action ? <div className="shrink-0">{action}</div> : null}
32 </header>
33​
34 {children}
35 </div>
36 );
38​
39export function ClerkUserProfileRefreshButton({
40 className,
41 disabled = false,
42 isPending,
43 onClick,
44}: {
45 readonly className?: string;
46 readonly disabled?: boolean;
47 readonly isPending: boolean;
48 readonly onClick: () => void;
49}) {
50 return (
51 <Button
52 size="sm"
53 variant="outline"
54 className={cn("text-[0.8125rem]", className)}
55 disabled={disabled || isPending}
56 onClick={onClick}
57 >
58 <RefreshCwIcon aria-hidden="true" className={cn("size-3.5", isPending && "animate-spin")} />
59 Refresh
60 </Button>
61 );
63​
64export function ClerkUserProfileRow({
65 children,
66 className,
67 icon,
68}: {
69 readonly children: ReactNode;
70 readonly className?: string;
71 readonly icon: ReactNode;
72}) {
73 return (
74 <li className={cn("border-t py-4 first:border-t-0", className)}>
75 <div className="flex items-start gap-3">
76 <div
77 aria-hidden="true"
78 className="flex size-8 shrink-0 items-center justify-center rounded-lg border bg-muted/32 text-muted-foreground"
79 >
80 {icon}
81 </div>
82 <div className="min-w-0 flex-1">{children}</div>
83 </div>
84 </li>
85 );