blocks-dusted 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +967 -3
  2. package/package.json +40 -40
  3. package/src/commands/add.js +143 -45
  4. package/src/commands/list.js +2 -2
  5. package/src/installers/checkRequirements.js +1 -0
  6. package/src/installers/copyTemplateFiles.js +23 -2
  7. package/src/installers/patchPayloadConfigCollections.js +92 -0
  8. package/src/installers/writeInstalledBlockReadme.js +17 -4
  9. package/src/registry/listTemplates.js +16 -7
  10. package/src/registry/loadTemplateManifest.js +20 -11
  11. package/src/registry/validateTemplateManifest.js +6 -5
  12. package/src/utils/paths.js +7 -0
  13. package/templates/blocks/DD-BookCall/Component.tsx +535 -573
  14. package/templates/blocks/DD-CardTemplate01/Component.tsx +45 -49
  15. package/templates/blocks/DD-Carousel-A/Component.tsx +249 -266
  16. package/templates/blocks/DD-Carousel-B/Component.tsx +403 -432
  17. package/templates/blocks/DD-ComparisonTable/Component.tsx +256 -272
  18. package/templates/blocks/DD-Contact/Component.tsx +434 -439
  19. package/templates/blocks/DD-Contact/config.ts +8 -3
  20. package/templates/blocks/DD-FeatCat/Component.tsx +302 -361
  21. package/templates/blocks/DD-FeatCat/config.ts +201 -204
  22. package/templates/blocks/DD-FeatStrip/Component.tsx +171 -201
  23. package/templates/blocks/DD-Hero/Component.tsx +297 -317
  24. package/templates/blocks/DD-HorizontalScroll/Component.tsx +244 -303
  25. package/templates/blocks/DD-MasonaryMedia/Component.tsx +202 -228
  26. package/templates/blocks/DD-MasonaryMedia/config.ts +13 -14
  27. package/templates/blocks/DD-Pricing/Component.tsx +372 -380
  28. package/templates/blocks/DD-Process/Component.tsx +149 -155
  29. package/templates/blocks/DD-Section/Component.tsx +266 -327
  30. package/templates/blocks/DD-Services/Component.tsx +176 -188
  31. package/templates/blocks/DD-ShowcaseGrid/Component.tsx +307 -317
  32. package/templates/blocks/DD-Slider-A/Component.tsx +237 -252
  33. package/templates/blocks/DD-StackCards/Component.tsx +137 -160
  34. package/templates/blocks/DD-Team/Component.tsx +247 -265
  35. package/templates/blocks/DD-TechStack/Component.tsx +57 -72
  36. package/templates/blocks/DD-Testimonials/Component.tsx +147 -147
  37. package/templates/blocks/DD-Testimonials/config.ts +66 -66
  38. package/templates/blocks/DD-Work/Component.tsx +315 -328
  39. package/templates/blocks/DD-Work-B/Component.tsx +294 -320
  40. package/templates/collections/Testimonials/README.md +11 -0
  41. package/templates/collections/Testimonials/Testimonials.ts +161 -0
  42. package/templates/collections/Testimonials/manifest.json +55 -0
  43. package/templates/components/RichText/README.md +13 -0
  44. package/templates/components/RichText/converter/componentConverter/blocks.tsx +43 -0
  45. package/templates/components/RichText/converter/componentConverter/types.ts +11 -0
  46. package/templates/components/RichText/converter/index.tsx +18 -0
  47. package/templates/components/RichText/converter/internalLinks.tsx +45 -0
  48. package/templates/components/RichText/converter/textConverter.tsx +27 -0
  49. package/templates/components/RichText/index.tsx +35 -0
  50. package/templates/components/RichText/manifest.json +80 -0
@@ -1,439 +1,434 @@
1
- "use client";
2
- import React, { type FormEvent, useMemo, useState } from "react";
3
- import * as LucideIcons from "lucide-react";
4
- import { Check, Loader2, Send } from "lucide-react";
5
- import { Input } from "@/components/ui/input";
6
- import { getClientSideURL } from "@/utilities/getURL";
7
-
8
- type Status = "idle" | "submitting" | "success" | "error";
9
- export type DDContactProps = {
10
- eyebrow?: string | null;
11
- headlineMain?: string | null;
12
- headlineAccent?: string | null;
13
- description?: string | null;
14
- infoItems?: Array<{
15
- iconName?: string | null;
16
- title: string;
17
- description: string;
18
- }> | null;
19
- availabilityActive?: boolean | null;
20
- availabilityLabel?: string | null;
21
- availabilitySubtext?: string | null;
22
- form?: string | number | { id?: string | number } | null;
23
- serviceOptions?: Array<{ label: string }> | null;
24
- budgetOptions?: Array<{ label: string }> | null;
25
- timelineOptions?: Array<{ label: string }> | null;
26
- sectionId?: string | null;
27
- customCSS?: string | null;
28
- };
29
- function DynamicIcon({
30
- name,
31
- size = 16,
32
- ...props
33
- }: { name?: string | null } & Omit<LucideIcons.LucideProps, "name">) {
34
- if (!name) return null;
35
- const Icon = (
36
- LucideIcons as unknown as Record<string, React.FC<LucideIcons.LucideProps>>
37
- )[name];
38
- if (!Icon) return null;
39
- return <Icon size={size} {...props} />;
40
- }
41
-
42
- export const DDContact: React.FC<DDContactProps> = ({
43
- eyebrow,
44
- headlineMain,
45
- headlineAccent,
46
- description,
47
- infoItems,
48
- availabilityActive,
49
- availabilityLabel,
50
- availabilitySubtext,
51
- form,
52
- serviceOptions,
53
- budgetOptions,
54
- timelineOptions,
55
- sectionId,
56
- customCSS,
57
- }) => {
58
- const [status, setStatus] = useState<Status>("idle");
59
- const [charCount, setCharCount] = useState(0);
60
-
61
- const formID = typeof form === "object" && form !== null ? form.id : form;
62
-
63
- const formIdentifier = useMemo(() => {
64
- const safeSection = (sectionId || "contact")
65
- .toLowerCase()
66
- .replace(/[^a-z0-9-_]/g, "-");
67
-
68
- return `studio-contact-${String(formID || "unknown")}-${safeSection}`;
69
- }, [formID, sectionId]);
70
-
71
- const handleSubmit = async (e: FormEvent<HTMLFormElement>) => {
72
- e.preventDefault();
73
- const formElement = e.currentTarget;
74
- const data = new FormData(formElement);
75
-
76
- const message = data.get("message") as string;
77
- if (message && message.length > 500) return;
78
-
79
- setStatus("submitting");
80
-
81
- const submissionData = [
82
- { field: "name", value: data.get("name") },
83
- { field: "email", value: data.get("email") },
84
- { field: "company", value: data.get("company") },
85
- { field: "service", value: data.get("service") },
86
- { field: "budget", value: data.get("budget") },
87
- { field: "timeline", value: data.get("timeline") },
88
- { field: "message", value: data.get("message") },
89
- ];
90
-
91
- if (!formID) {
92
- setStatus("success");
93
- formElement.reset();
94
- setCharCount(0);
95
- return;
96
- }
97
-
98
- try {
99
- const res = await fetch(`${getClientSideURL()}/api/form-submissions`, {
100
- method: "POST",
101
- headers: {
102
- "Content-Type": "application/json",
103
- },
104
- body: JSON.stringify({
105
- form: formID,
106
- submissionData,
107
- }),
108
- });
109
-
110
- if (res.ok) {
111
- setStatus("success");
112
- formElement.reset();
113
- setCharCount(0);
114
- } else {
115
- setStatus("error");
116
- }
117
- } catch {
118
- setStatus("error");
119
- }
120
- };
121
-
122
- return (
123
- <>
124
- {customCSS && <style dangerouslySetInnerHTML={{ __html: customCSS }} />}
125
-
126
- <div id={sectionId ?? "contact"} className="py-24">
127
- <div className="max-w-6xl lg:max-w-7xl mx-auto px-4 md:px-6">
128
- <div className="grid grid-cols-1 lg:grid-cols-2 gap-16 items-start">
129
- <div>
130
- {eyebrow && (
131
- <p className="text-[11.5px] font-semibold text-stone-400 tracking-widest uppercase mb-3 top-caption">
132
- {eyebrow}
133
- </p>
134
- )}
135
-
136
- <h2 className="text-4xl md:text-5xl font-semibold text-stone-900 dark:text-stone-50 leading-tight mb-6">
137
- {headlineMain}
138
- <br />
139
- <span className="text-stone-400">{headlineAccent}</span>
140
- </h2>
141
-
142
- {description && (
143
- <p className="text-stone-700 dark:text-stone-300 text-base leading-relaxed mb-10">
144
- {description}
145
- </p>
146
- )}
147
-
148
- {infoItems && infoItems.length > 0 && (
149
- <div className="space-y-4 mb-10">
150
- {infoItems.map((item, i) => (
151
- <div key={i} className="flex gap-4">
152
- <div className="w-9 h-9 flex items-center justify-center rounded-lg lime-glass border border-indigo-400 bg-stone-100/50 dark:bg-stone-900/80 shrink-0 mt-0.5">
153
- <DynamicIcon
154
- className="text-indigo-500 dark:text-lime-500"
155
- name={item.iconName}
156
- size={15}
157
- />
158
- </div>
159
- <div>
160
- <div className="text-sm font-semibold text-stone-800 dark:text-stone-50 mb-0.5">
161
- {item.title}
162
- </div>
163
- <div className="text-xs text-stone-600 dark:text-stone-300">
164
- {item.description}
165
- </div>
166
- </div>
167
- </div>
168
- ))}
169
- </div>
170
- )}
171
-
172
- {availabilityActive && (
173
- <div
174
- className="flex items-center gap-3 p-4 bg-indigo-900 border border-indigo-500 shadow-xl backdrop-blur-sm rounded-2xl pressable relative z-10 h-full w-full text-[32px] font-medium tracking-[.001em] transition-all duration-300"
175
- style={{ cornerShape: "squircle" } as React.CSSProperties}
176
- >
177
- <div className="w-3.5 h-3.5 rounded-full bg-lime-700 border-2 border-lime-500 animate-pulse shrink-0 shadow-2xl" />
178
- <div>
179
- {availabilityLabel && (
180
- <div className="text-md font-semibold text-lime-500 dark:text-stone-50">
181
- {availabilityLabel}
182
- </div>
183
- )}
184
-
185
- {availabilitySubtext && (
186
- <div className="text-xs font-normal! text-stone-300 pt-1">
187
- {availabilitySubtext}
188
- </div>
189
- )}
190
- </div>
191
- </div>
192
- )}
193
- </div>
194
-
195
- <div className="rounded-2xl bg-stone-100 dark:bg-stone-950 border border-stone-100 dark:border-stone-800 dark:hover:border-indigo-800 px-3 md:px-8 py-8 shadow-sm hover:shadow-2xl transition-all duration-300">
196
- {status === "success" ? (
197
- <div className="flex flex-col items-center justify-center text-center py-12">
198
- <div className="w-16 h-16 flex items-center justify-center rounded-full bg-lime-400/10 border border-emerald-400/30 mb-5">
199
- <Check size={28} className="text-lime-400" />
200
- </div>
201
-
202
- <h3 className="text-xl font-semibold text-stone-900 dark:text-stone-50 mb-2">
203
- Message sent!
204
- </h3>
205
-
206
- <p className="text-sm text-stone-400 max-w-xs">
207
- Thanks for reaching out. We'll review your project details
208
- and get back to you within one business day.
209
- </p>
210
-
211
- <button
212
- onClick={() => setStatus("idle")}
213
- className="mt-6 px-5 py-2.5 rounded-lgbg-stone-700 text-stone-200 text-sm font-medium hover:bg-stone-600 transition-colors cursor-pointer"
214
- >
215
- Send another message
216
- </button>
217
- </div>
218
- ) : (
219
- <form
220
- id={formIdentifier}
221
- name={formIdentifier}
222
- data-form-id={String(formID || "")}
223
- onSubmit={handleSubmit}
224
- className="space-y-5"
225
- >
226
- <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
227
- <div>
228
- <label
229
- htmlFor={`${formIdentifier}-name`}
230
- className="block text-xs font-medium text-stone-400 mb-1.5"
231
- >
232
- Your Name *
233
- </label>
234
-
235
- <Input
236
- id={`${formIdentifier}-name`}
237
- type="text"
238
- name="name"
239
- autoComplete="name"
240
- required
241
- placeholder="Marcus Holt"
242
- className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
243
- />
244
- </div>
245
-
246
- <div>
247
- <label
248
- htmlFor={`${formIdentifier}-email`}
249
- className="block text-xs font-medium text-stone-400 mb-1.5"
250
- >
251
- Email Address *
252
- </label>
253
-
254
- <Input
255
- id={`${formIdentifier}-email`}
256
- type="email"
257
- name="email"
258
- autoComplete="email"
259
- required
260
- placeholder="you@company.com"
261
- className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
262
- />
263
- </div>
264
- </div>
265
-
266
- <div>
267
- <label
268
- htmlFor={`${formIdentifier}-company`}
269
- className="block text-xs font-medium text-stone-400 mb-1.5"
270
- >
271
- Company / Project Name
272
- </label>
273
-
274
- <Input
275
- id={`${formIdentifier}-company`}
276
- type="text"
277
- name="company"
278
- autoComplete="organization"
279
- placeholder="Acme Inc."
280
- className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
281
- />
282
- </div>
283
-
284
- {serviceOptions && serviceOptions.length > 0 && (
285
- <div>
286
- <label
287
- htmlFor={`${formIdentifier}-service`}
288
- className="block text-xs font-medium text-stone-400 mb-1.5"
289
- >
290
- Service Needed *
291
- </label>
292
-
293
- <select
294
- id={`${formIdentifier}-service`}
295
- name="service"
296
- autoComplete="off"
297
- required
298
- defaultValue=""
299
- className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
300
- >
301
- <option value="" disabled>
302
- Select a service...
303
- </option>
304
-
305
- {serviceOptions.map((s, i) => (
306
- <option key={i} value={s.label}>
307
- {s.label}
308
- </option>
309
- ))}
310
- </select>
311
- </div>
312
- )}
313
-
314
- <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
315
- {budgetOptions && budgetOptions.length > 0 && (
316
- <div>
317
- <label
318
- htmlFor={`${formIdentifier}-budget`}
319
- className="block text-xs font-medium text-stone-400 mb-1.5"
320
- >
321
- Budget Range *
322
- </label>
323
-
324
- <select
325
- id={`${formIdentifier}-budget`}
326
- name="budget"
327
- autoComplete="off"
328
- required
329
- defaultValue=""
330
- className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
331
- >
332
- <option value="" disabled>
333
- Select budget...
334
- </option>
335
-
336
- {budgetOptions.map((b, i) => (
337
- <option key={i} value={b.label}>
338
- {b.label}
339
- </option>
340
- ))}
341
- </select>
342
- </div>
343
- )}
344
-
345
- {timelineOptions && timelineOptions.length > 0 && (
346
- <div>
347
- <label
348
- htmlFor={`${formIdentifier}-timeline`}
349
- className="block text-xs font-medium text-stone-400 mb-1.5"
350
- >
351
- Timeline
352
- </label>
353
-
354
- <select
355
- id={`${formIdentifier}-timeline`}
356
- name="timeline"
357
- autoComplete="off"
358
- defaultValue=""
359
- className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
360
- >
361
- <option value="" disabled>
362
- Select timeline...
363
- </option>
364
-
365
- {timelineOptions.map((t, i) => (
366
- <option key={i} value={t.label}>
367
- {t.label}
368
- </option>
369
- ))}
370
- </select>
371
- </div>
372
- )}
373
- </div>
374
-
375
- <div>
376
- <label
377
- htmlFor={`${formIdentifier}-message`}
378
- className="block text-xs font-medium text-stone-400 mb-1.5"
379
- >
380
- Project Description *
381
- <span
382
- className={`ml-2 font-normal ${charCount > 500 ? "text-red-400" : "text-stone-400"}`}
383
- >
384
- {charCount}/500
385
- </span>
386
- </label>
387
-
388
- <textarea
389
- id={`${formIdentifier}-message`}
390
- name="message"
391
- autoComplete="off"
392
- required
393
- rows={4}
394
- maxLength={500}
395
- placeholder="Tell us about your project — what you're building, what problem it solves, and any technical constraints..."
396
- onChange={(e) => setCharCount(e.target.value.length)}
397
- className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
398
- />
399
- </div>
400
-
401
- {status === "error" && (
402
- <p className="text-xs text-red-400">
403
- Something went wrong. Please try again.
404
- </p>
405
- )}
406
-
407
- <button
408
- type="submit"
409
- disabled={status === "submitting" || charCount > 500}
410
- className="glass-button-white group relative isolate flex w-full cursor-pointer items-center justify-center gap-2 overflow-hidden rounded-4xl! border border-white/30 dark:border-white bg- px-6 py-3 text-sm font-semibold text-stone-100 dark:text-stone-900 bg-stone-950/90 dark:bg-stone-100/80 outline-offset-0 dark:hover:bg-stone-100 hover:shadow-2xl hover:-translate-y-0.5 hover:outline-4 hover:outline-indigo-500 hover:-outline-offset-1 disabled:cursor-not-allowed disabled:opacity-50 transition-all duration-300"
411
- style={{ cornerShape: "squircle" } as React.CSSProperties}
412
- >
413
- <span className="relative z-2 flex items-center gap-2">
414
- {status === "submitting" ? (
415
- <>
416
- <Loader2 size={15} className="animate-spin" />
417
- Sending...
418
- </>
419
- ) : (
420
- <>
421
- <Send size={15} />
422
- Send Project Brief
423
- </>
424
- )}
425
- </span>
426
- </button>
427
-
428
- <p className="text-xs text-stone-700 dark:text-stone-400 text-center">
429
- We'll respond within 1 business day. No spam, ever.
430
- </p>
431
- </form>
432
- )}
433
- </div>
434
- </div>
435
- </div>
436
- </div>
437
- </>
438
- );
439
- };
1
+ 'use client'
2
+ import React, { type FormEvent, useMemo, useState } from 'react'
3
+ import * as LucideIcons from 'lucide-react'
4
+ import { Check, Loader2, Send } from 'lucide-react'
5
+ import { Input } from '@/components/ui/input'
6
+ import { getClientSideURL } from '@/utilities/getURL'
7
+
8
+ type Status = 'idle' | 'submitting' | 'success' | 'error'
9
+ export type DDContactProps = {
10
+ eyebrow?: string | null
11
+ headlineMain?: string | null
12
+ headlineAccent?: string | null
13
+ description?: string | null
14
+ infoItems?: Array<{
15
+ iconName?: string | null
16
+ title: string
17
+ description: string
18
+ }> | null
19
+ availabilityActive?: boolean | null
20
+ availabilityLabel?: string | null
21
+ availabilitySubtext?: string | null
22
+ form?: string | number | { id?: string | number } | null
23
+ serviceOptions?: Array<{ label: string }> | null
24
+ budgetOptions?: Array<{ label: string }> | null
25
+ timelineOptions?: Array<{ label: string }> | null
26
+ sectionId?: string | null
27
+ customCSS?: string | null
28
+ }
29
+ function DynamicIcon({
30
+ name,
31
+ size = 16,
32
+ ...props
33
+ }: { name?: string | null } & Omit<LucideIcons.LucideProps, 'name'>) {
34
+ if (!name) return null
35
+ const Icon = (LucideIcons as unknown as Record<string, React.FC<LucideIcons.LucideProps>>)[name]
36
+ if (!Icon) return null
37
+ return <Icon size={size} {...props} />
38
+ }
39
+
40
+ export const DDContact: React.FC<DDContactProps> = ({
41
+ eyebrow,
42
+ headlineMain,
43
+ headlineAccent,
44
+ description,
45
+ infoItems,
46
+ availabilityActive,
47
+ availabilityLabel,
48
+ availabilitySubtext,
49
+ form,
50
+ serviceOptions,
51
+ budgetOptions,
52
+ timelineOptions,
53
+ sectionId,
54
+ customCSS,
55
+ }) => {
56
+ const [status, setStatus] = useState<Status>('idle')
57
+ const [charCount, setCharCount] = useState(0)
58
+
59
+ const formID = typeof form === 'object' && form !== null ? form.id : form
60
+
61
+ const formIdentifier = useMemo(() => {
62
+ const safeSection = (sectionId || 'contact').toLowerCase().replace(/[^a-z0-9-_]/g, '-')
63
+
64
+ return `studio-contact-${String(formID || 'unknown')}-${safeSection}`
65
+ }, [formID, sectionId])
66
+
67
+ const handleSubmit = async (e: FormEvent<HTMLFormElement>) => {
68
+ e.preventDefault()
69
+ const formElement = e.currentTarget
70
+ const data = new FormData(formElement)
71
+
72
+ const message = data.get('message') as string
73
+ if (message && message.length > 500) return
74
+
75
+ setStatus('submitting')
76
+
77
+ const submissionData = [
78
+ { field: 'name', value: data.get('name') },
79
+ { field: 'email', value: data.get('email') },
80
+ { field: 'company', value: data.get('company') },
81
+ { field: 'service', value: data.get('service') },
82
+ { field: 'budget', value: data.get('budget') },
83
+ { field: 'timeline', value: data.get('timeline') },
84
+ { field: 'message', value: data.get('message') },
85
+ ]
86
+
87
+ if (!formID) {
88
+ setStatus('success')
89
+ formElement.reset()
90
+ setCharCount(0)
91
+ return
92
+ }
93
+
94
+ try {
95
+ const res = await fetch(`${getClientSideURL()}/api/form-submissions`, {
96
+ method: 'POST',
97
+ headers: {
98
+ 'Content-Type': 'application/json',
99
+ },
100
+ body: JSON.stringify({
101
+ form: formID,
102
+ submissionData,
103
+ }),
104
+ })
105
+
106
+ if (res.ok) {
107
+ setStatus('success')
108
+ formElement.reset()
109
+ setCharCount(0)
110
+ } else {
111
+ setStatus('error')
112
+ }
113
+ } catch {
114
+ setStatus('error')
115
+ }
116
+ }
117
+
118
+ return (
119
+ <>
120
+ {customCSS && <style dangerouslySetInnerHTML={{ __html: customCSS }} />}
121
+
122
+ <div id={sectionId ?? 'contact'} className="py-24">
123
+ <div className="max-w-6xl lg:max-w-7xl mx-auto px-4 md:px-6">
124
+ #BlockName-DDContact
125
+ <div className="grid grid-cols-1 lg:grid-cols-2 gap-16 items-start">
126
+ <div>
127
+ {eyebrow && (
128
+ <p className="text-[11.5px] font-semibold text-stone-400 tracking-widest uppercase mb-3 top-caption">
129
+ {eyebrow}
130
+ </p>
131
+ )}
132
+
133
+ <h2 className="text-4xl md:text-5xl font-semibold text-stone-900 dark:text-stone-50 leading-tight mb-6">
134
+ {headlineMain}
135
+ <br />
136
+ <span className="text-stone-400">{headlineAccent}</span>
137
+ </h2>
138
+
139
+ {description && (
140
+ <p className="text-stone-700 dark:text-stone-300 text-base leading-relaxed mb-10">
141
+ {description}
142
+ </p>
143
+ )}
144
+
145
+ {infoItems && infoItems.length > 0 && (
146
+ <div className="space-y-4 mb-10">
147
+ {infoItems.map((item, i) => (
148
+ <div key={i} className="flex gap-4">
149
+ <div className="w-9 h-9 flex items-center justify-center rounded-lg lime-glass border border-indigo-400 bg-stone-100/50 dark:bg-stone-900/80 shrink-0 mt-0.5">
150
+ <DynamicIcon
151
+ className="text-indigo-500 dark:text-lime-500"
152
+ name={item.iconName}
153
+ size={15}
154
+ />
155
+ </div>
156
+ <div>
157
+ <div className="text-sm font-semibold text-stone-800 dark:text-stone-50 mb-0.5">
158
+ {item.title}
159
+ </div>
160
+ <div className="text-xs text-stone-600 dark:text-stone-300">
161
+ {item.description}
162
+ </div>
163
+ </div>
164
+ </div>
165
+ ))}
166
+ </div>
167
+ )}
168
+
169
+ {availabilityActive && (
170
+ <div
171
+ className="flex items-center gap-3 p-4 bg-indigo-900 border border-indigo-500 shadow-xl backdrop-blur-sm rounded-2xl pressable relative z-10 h-full w-full text-[32px] font-medium tracking-[.001em] transition-all duration-300"
172
+ style={{ cornerShape: 'squircle' } as React.CSSProperties}
173
+ >
174
+ <div className="w-3.5 h-3.5 rounded-full bg-lime-700 border-2 border-lime-500 animate-pulse shrink-0 shadow-2xl" />
175
+ <div>
176
+ {availabilityLabel && (
177
+ <div className="text-md font-semibold text-lime-500 dark:text-stone-50">
178
+ {availabilityLabel}
179
+ </div>
180
+ )}
181
+
182
+ {availabilitySubtext && (
183
+ <div className="text-xs font-normal! text-stone-300 pt-1">
184
+ {availabilitySubtext}
185
+ </div>
186
+ )}
187
+ </div>
188
+ </div>
189
+ )}
190
+ </div>
191
+
192
+ <div className="rounded-2xl bg-stone-100 dark:bg-stone-950 border border-stone-100 dark:border-stone-800 dark:hover:border-indigo-800 px-3 md:px-8 py-8 shadow-sm hover:shadow-2xl transition-all duration-300">
193
+ {status === 'success' ? (
194
+ <div className="flex flex-col items-center justify-center text-center py-12">
195
+ <div className="w-16 h-16 flex items-center justify-center rounded-full bg-lime-400/10 border border-emerald-400/30 mb-5">
196
+ <Check size={28} className="text-lime-400" />
197
+ </div>
198
+
199
+ <h3 className="text-xl font-semibold text-stone-900 dark:text-stone-50 mb-2">
200
+ Message sent!
201
+ </h3>
202
+
203
+ <p className="text-sm text-stone-400 max-w-xs">
204
+ Thanks for reaching out. We'll review your project details and get back to you
205
+ within one business day.
206
+ </p>
207
+
208
+ <button
209
+ onClick={() => setStatus('idle')}
210
+ className="mt-6 px-5 py-2.5 rounded-lgbg-stone-700 text-stone-200 text-sm font-medium hover:bg-stone-600 transition-colors cursor-pointer"
211
+ >
212
+ Send another message
213
+ </button>
214
+ </div>
215
+ ) : (
216
+ <form
217
+ id={formIdentifier}
218
+ name={formIdentifier}
219
+ data-form-id={String(formID || '')}
220
+ onSubmit={handleSubmit}
221
+ className="space-y-5"
222
+ >
223
+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
224
+ <div>
225
+ <label
226
+ htmlFor={`${formIdentifier}-name`}
227
+ className="block text-xs font-medium text-stone-400 mb-1.5"
228
+ >
229
+ Your Name *
230
+ </label>
231
+
232
+ <Input
233
+ id={`${formIdentifier}-name`}
234
+ type="text"
235
+ name="name"
236
+ autoComplete="name"
237
+ required
238
+ placeholder="Marcus Holt"
239
+ className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
240
+ />
241
+ </div>
242
+
243
+ <div>
244
+ <label
245
+ htmlFor={`${formIdentifier}-email`}
246
+ className="block text-xs font-medium text-stone-400 mb-1.5"
247
+ >
248
+ Email Address *
249
+ </label>
250
+
251
+ <Input
252
+ id={`${formIdentifier}-email`}
253
+ type="email"
254
+ name="email"
255
+ autoComplete="email"
256
+ required
257
+ placeholder="you@company.com"
258
+ className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
259
+ />
260
+ </div>
261
+ </div>
262
+
263
+ <div>
264
+ <label
265
+ htmlFor={`${formIdentifier}-company`}
266
+ className="block text-xs font-medium text-stone-400 mb-1.5"
267
+ >
268
+ Company / Project Name
269
+ </label>
270
+
271
+ <Input
272
+ id={`${formIdentifier}-company`}
273
+ type="text"
274
+ name="company"
275
+ autoComplete="organization"
276
+ placeholder="Acme Inc."
277
+ className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
278
+ />
279
+ </div>
280
+
281
+ {serviceOptions && serviceOptions.length > 0 && (
282
+ <div>
283
+ <label
284
+ htmlFor={`${formIdentifier}-service`}
285
+ className="block text-xs font-medium text-stone-400 mb-1.5"
286
+ >
287
+ Service Needed *
288
+ </label>
289
+
290
+ <select
291
+ id={`${formIdentifier}-service`}
292
+ name="service"
293
+ autoComplete="off"
294
+ required
295
+ defaultValue=""
296
+ className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
297
+ >
298
+ <option value="" disabled>
299
+ Select a service...
300
+ </option>
301
+
302
+ {serviceOptions.map((s, i) => (
303
+ <option key={i} value={s.label}>
304
+ {s.label}
305
+ </option>
306
+ ))}
307
+ </select>
308
+ </div>
309
+ )}
310
+
311
+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
312
+ {budgetOptions && budgetOptions.length > 0 && (
313
+ <div>
314
+ <label
315
+ htmlFor={`${formIdentifier}-budget`}
316
+ className="block text-xs font-medium text-stone-400 mb-1.5"
317
+ >
318
+ Budget Range *
319
+ </label>
320
+
321
+ <select
322
+ id={`${formIdentifier}-budget`}
323
+ name="budget"
324
+ autoComplete="off"
325
+ required
326
+ defaultValue=""
327
+ className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
328
+ >
329
+ <option value="" disabled>
330
+ Select budget...
331
+ </option>
332
+
333
+ {budgetOptions.map((b, i) => (
334
+ <option key={i} value={b.label}>
335
+ {b.label}
336
+ </option>
337
+ ))}
338
+ </select>
339
+ </div>
340
+ )}
341
+
342
+ {timelineOptions && timelineOptions.length > 0 && (
343
+ <div>
344
+ <label
345
+ htmlFor={`${formIdentifier}-timeline`}
346
+ className="block text-xs font-medium text-stone-400 mb-1.5"
347
+ >
348
+ Timeline
349
+ </label>
350
+
351
+ <select
352
+ id={`${formIdentifier}-timeline`}
353
+ name="timeline"
354
+ autoComplete="off"
355
+ defaultValue=""
356
+ className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
357
+ >
358
+ <option value="" disabled>
359
+ Select timeline...
360
+ </option>
361
+
362
+ {timelineOptions.map((t, i) => (
363
+ <option key={i} value={t.label}>
364
+ {t.label}
365
+ </option>
366
+ ))}
367
+ </select>
368
+ </div>
369
+ )}
370
+ </div>
371
+
372
+ <div>
373
+ <label
374
+ htmlFor={`${formIdentifier}-message`}
375
+ className="block text-xs font-medium text-stone-400 mb-1.5"
376
+ >
377
+ Project Description *
378
+ <span
379
+ className={`ml-2 font-normal ${charCount > 500 ? 'text-red-400' : 'text-stone-400'}`}
380
+ >
381
+ {charCount}/500
382
+ </span>
383
+ </label>
384
+
385
+ <textarea
386
+ id={`${formIdentifier}-message`}
387
+ name="message"
388
+ autoComplete="off"
389
+ required
390
+ rows={4}
391
+ maxLength={500}
392
+ placeholder="Tell us about your project — what you're building, what problem it solves, and any technical constraints..."
393
+ onChange={(e) => setCharCount(e.target.value.length)}
394
+ className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
395
+ />
396
+ </div>
397
+
398
+ {status === 'error' && (
399
+ <p className="text-xs text-red-400">Something went wrong. Please try again.</p>
400
+ )}
401
+
402
+ <button
403
+ type="submit"
404
+ disabled={status === 'submitting' || charCount > 500}
405
+ className="glass-button-white group relative isolate flex w-full cursor-pointer items-center justify-center gap-2 overflow-hidden rounded-4xl! border border-white/30 dark:border-white bg- px-6 py-3 text-sm font-semibold text-stone-100 dark:text-stone-900 bg-stone-950/90 dark:bg-stone-100/80 outline-offset-0 dark:hover:bg-stone-100 hover:shadow-2xl hover:-translate-y-0.5 hover:outline-4 hover:outline-indigo-500 hover:-outline-offset-1 disabled:cursor-not-allowed disabled:opacity-50 transition-all duration-300"
406
+ style={{ cornerShape: 'squircle' } as React.CSSProperties}
407
+ >
408
+ <span className="relative z-2 flex items-center gap-2">
409
+ {status === 'submitting' ? (
410
+ <>
411
+ <Loader2 size={15} className="animate-spin" />
412
+ Sending...
413
+ </>
414
+ ) : (
415
+ <>
416
+ <Send size={15} />
417
+ Send Project Brief
418
+ </>
419
+ )}
420
+ </span>
421
+ </button>
422
+
423
+ <p className="text-xs text-stone-700 dark:text-stone-400 text-center">
424
+ We'll respond within 1 business day. No spam, ever.
425
+ </p>
426
+ </form>
427
+ )}
428
+ </div>
429
+ </div>
430
+ </div>
431
+ </div>
432
+ </>
433
+ )
434
+ }