forked from dodopayments/billingsdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquick-integrations.tsx
More file actions
294 lines (281 loc) · 9.6 KB
/
quick-integrations.tsx
File metadata and controls
294 lines (281 loc) · 9.6 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
"use client";
import { motion } from "motion/react";
import { cn } from "@/lib/utils";
import { ArrowRight, CheckIcon, Zap } from "lucide-react";
import { ShineButton } from "./shine-button";
import { CodeBlock, CodeBlockCopyButton } from "./code-block";
import {
CodeBlockTabs,
CodeBlockTabsList,
CodeBlockTabsTrigger,
CodeBlockTab,
} from "fumadocs-ui/components/codeblock";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import Link from "next/link";
import Image from "next/image";
interface QuickIntegrationDataItem {
heading: string;
href: string;
label: string;
description: string;
subPoints: string[];
codeExample: {
title: string;
code?: string;
language: string;
commands?: {
npm: string;
pnpm: string;
bun: string;
};
};
}
export const billingQuickIntegrationData: QuickIntegrationDataItem[] = [
{
heading: "Installation",
href: "/docs/quick-start",
label: "Follow Installation",
description:
"Get started with Billing SDK in seconds. Choose between our CLI tool for complete project setup or add individual components using shadcn. Both methods provide TypeScript-first components with full theme integration.",
subPoints: [
"One-command project initialization",
"Individual component installation",
"Automatic dependency management",
],
codeExample: {
title: "Install any component instantly",
language: "shell",
commands: {
npm: "npx shadcn@latest add @billingsdk/pricing-table-one",
pnpm: "pnpm dlx shadcn@latest add @billingsdk/pricing-table-one",
bun: "bunx shadcn@latest add @billingsdk/pricing-table-one",
},
},
},
{
heading: "Configure Theming",
href: "/docs/theming",
label: "Play with Themes",
description:
"Customize your billing components with our comprehensive theming system. Choose from pre-built themes like Cyberpunk, Elegant, or Minimal, or create your own using CSS variables for perfect brand integration.",
subPoints: [
"10+ pre-built theme variants",
"CSS variable-based customization",
"Dark/light mode support",
],
codeExample: {
title: "Apply custom theme colors",
code: `:root {
--primary: oklch(0.6 0.25 253);
--primary-foreground: oklch(0.985 0 0);
--secondary: oklch(0.97 0.01 253);
--radius: 0.625rem;
}`,
language: "css",
},
},
{
heading: "Usage",
href: "/docs/quick-start#use-in-your-app",
label: "Implement Usage",
description:
"Start building with production-ready components immediately. Import your chosen component, pass your pricing data, and handle user interactions with simple callback functions. Full TypeScript support included.",
subPoints: [
"Import and use instantly",
"TypeScript interfaces included",
"Callback-based event handling",
],
codeExample: {
title: "Use components with full TypeScript support",
code: `import { PricingTableOne } from "@/components/billingsdk/pricing-table-one";
import { plans } from "@/lib/billingsdk-config";
<PricingTableOne
plans={plans}
onPlanSelect={(planId) => console.log('Selected:', planId)}
theme="classic"
size="medium"
/>`,
language: "tsx",
},
},
];
const CodeExample = ({
example,
}: {
example: QuickIntegrationDataItem["codeExample"];
}) => {
if (example.commands) {
return (
<div className="">
<Badge
variant={"secondary"}
className="text-muted-foreground text-sm font-normal"
>
{example.title}
</Badge>
<CodeBlockTabs
defaultValue="npm"
className="w-full bg-black/20 p-2 backdrop-blur-lg"
>
<CodeBlockTabsList className="w-full">
<CodeBlockTabsTrigger value="npm">npm</CodeBlockTabsTrigger>
<CodeBlockTabsTrigger value="pnpm">pnpm</CodeBlockTabsTrigger>
<CodeBlockTabsTrigger value="bun">bun</CodeBlockTabsTrigger>
</CodeBlockTabsList>
<CodeBlockTab value="npm" className="w-full p-2">
<CodeBlock
className="max-w-full bg-black/20 backdrop-blur-lg md:max-w-md"
code={example.commands.npm}
language={example.language}
>
<CodeBlockCopyButton />
</CodeBlock>
</CodeBlockTab>
<CodeBlockTab value="pnpm" className="w-full p-2">
<CodeBlock
className="max-w-full bg-black/20 backdrop-blur-lg md:max-w-md"
code={example.commands.pnpm}
language={example.language}
>
<CodeBlockCopyButton />
</CodeBlock>
</CodeBlockTab>
<CodeBlockTab value="bun" className="w-full p-2">
<CodeBlock
className="max-w-full bg-black/20 backdrop-blur-lg md:max-w-md"
code={example.commands.bun}
language={example.language}
>
<CodeBlockCopyButton />
</CodeBlock>
</CodeBlockTab>
</CodeBlockTabs>
</div>
);
}
return (
<div className="">
<Badge
variant={"secondary"}
className="text-muted-foreground mb-3 text-sm font-normal"
>
{example.title}
</Badge>
<CodeBlock
className="max-w-full bg-black/50 backdrop-blur-lg md:max-w-md"
showLineNumbers
code={example.code!}
language={example.language}
>
<CodeBlockCopyButton />
</CodeBlock>
</div>
);
};
export function QuickIntegration() {
return (
<div className="my-20 flex max-h-fit min-h-[30rem] flex-col items-center px-4">
<motion.div
initial={{ opacity: 0, y: 20 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{
once: true,
}}
transition={{
duration: 0.9,
delay: 0.2,
ease: [0.16, 1, 0.3, 1],
}}
>
<ShineButton Icon={Zap} label="Quick Integration" />
</motion.div>
<motion.h2
initial={{ opacity: 0, y: 20 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{
once: true,
}}
transition={{
duration: 0.9,
delay: 0.2,
ease: [0.16, 1, 0.3, 1],
}}
className="font-display text-primary animate-in fade-in slide-in-from-bottom-4 mt-4 max-w-2xl text-center text-3xl font-medium text-balance duration-1000 sm:text-3xl md:text-5xl"
>
Get your billing system running in minutes
</motion.h2>
<div className="mt-14 flex w-full max-w-7xl flex-col gap-8">
{billingQuickIntegrationData.map((item, index) => (
<motion.div
key={item.heading}
initial={{
opacity: 0,
y: 20,
filter: "blur(10px)",
}}
viewport={{
once: true,
}}
whileInView={{ opacity: 1, y: 0, filter: "blur(0px)" }}
transition={{
duration: 0.6,
delay: 0.3 + index * 0.2,
ease: "easeInOut",
}}
className={`border-muted bg-muted/20 flex w-full flex-col items-start gap-8 rounded-3xl p-6 xl:flex-row`}
>
<div className="h-fit w-full rounded-md p-4 xl:aspect-[3/2] xl:h-full xl:w-1/2">
<div className="flex flex-col gap-4 xl:h-[calc(100%-25px)]">
<Image
src="/landing/gradient2.png"
alt="Moon background"
fill
className="absolute top-0 left-0 h-full w-full object-cover opacity-20 blur"
/>
<div className="flex flex-col gap-4">
<div className="flex items-center gap-3">
<div className="text-lg md:text-xl">
{index + 1}. {item.heading}
</div>
</div>
<div className="text-muted-foreground/80 text-sm leading-relaxed lg:text-base">
{item.description}
</div>
<div className="mt-2 flex flex-col gap-2">
{item.subPoints.map((point, pointIndex) => (
<div
key={pointIndex}
className="text-muted-foreground flex items-center gap-3 text-base"
>
<div
className={cn(
"rounded-full p-0.5 transition-colors duration-200",
)}
>
<CheckIcon className="fill-primary text-primary-foreground size-5" />
</div>
{point}
</div>
))}
</div>
</div>
</div>
<Button asChild variant={"secondary"} className="mt-4 xl:mt-0">
<Link href={item.href} className="flex items-center gap-2">
<span>{item.label}</span>
<ArrowRight className="size-4" />
</Link>
</Button>
</div>
<div className="bg-muted/20 border-muted/80 relative hidden w-full overflow-x-scroll rounded-xl border px-6 py-10 transition-all duration-500 md:block md:overflow-auto xl:aspect-[3/2] xl:w-1/2 xl:py-0">
<div className="mx-auto flex h-full max-w-full items-center md:max-w-1/2 md:justify-center">
<CodeExample example={item.codeExample} />
</div>
</div>
</motion.div>
))}
</div>
</div>
);
}