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.
- package/README.md +967 -3
- package/package.json +40 -40
- package/src/commands/add.js +143 -45
- package/src/commands/list.js +2 -2
- package/src/installers/checkRequirements.js +1 -0
- package/src/installers/copyTemplateFiles.js +23 -2
- package/src/installers/patchPayloadConfigCollections.js +92 -0
- package/src/installers/writeInstalledBlockReadme.js +17 -4
- package/src/registry/listTemplates.js +16 -7
- package/src/registry/loadTemplateManifest.js +20 -11
- package/src/registry/validateTemplateManifest.js +6 -5
- package/src/utils/paths.js +7 -0
- package/templates/blocks/DD-BookCall/Component.tsx +535 -573
- package/templates/blocks/DD-CardTemplate01/Component.tsx +45 -49
- package/templates/blocks/DD-Carousel-A/Component.tsx +249 -266
- package/templates/blocks/DD-Carousel-B/Component.tsx +403 -432
- package/templates/blocks/DD-ComparisonTable/Component.tsx +256 -272
- package/templates/blocks/DD-Contact/Component.tsx +434 -439
- package/templates/blocks/DD-Contact/config.ts +8 -3
- package/templates/blocks/DD-FeatCat/Component.tsx +302 -361
- package/templates/blocks/DD-FeatCat/config.ts +201 -204
- package/templates/blocks/DD-FeatStrip/Component.tsx +171 -201
- package/templates/blocks/DD-Hero/Component.tsx +297 -317
- package/templates/blocks/DD-HorizontalScroll/Component.tsx +244 -303
- package/templates/blocks/DD-MasonaryMedia/Component.tsx +202 -228
- package/templates/blocks/DD-MasonaryMedia/config.ts +13 -14
- package/templates/blocks/DD-Pricing/Component.tsx +372 -380
- package/templates/blocks/DD-Process/Component.tsx +149 -155
- package/templates/blocks/DD-Section/Component.tsx +266 -327
- package/templates/blocks/DD-Services/Component.tsx +176 -188
- package/templates/blocks/DD-ShowcaseGrid/Component.tsx +307 -317
- package/templates/blocks/DD-Slider-A/Component.tsx +237 -252
- package/templates/blocks/DD-StackCards/Component.tsx +137 -160
- package/templates/blocks/DD-Team/Component.tsx +247 -265
- package/templates/blocks/DD-TechStack/Component.tsx +57 -72
- package/templates/blocks/DD-Testimonials/Component.tsx +147 -147
- package/templates/blocks/DD-Testimonials/config.ts +66 -66
- package/templates/blocks/DD-Work/Component.tsx +315 -328
- package/templates/blocks/DD-Work-B/Component.tsx +294 -320
- package/templates/collections/Testimonials/README.md +11 -0
- package/templates/collections/Testimonials/Testimonials.ts +161 -0
- package/templates/collections/Testimonials/manifest.json +55 -0
- package/templates/components/RichText/README.md +13 -0
- package/templates/components/RichText/converter/componentConverter/blocks.tsx +43 -0
- package/templates/components/RichText/converter/componentConverter/types.ts +11 -0
- package/templates/components/RichText/converter/index.tsx +18 -0
- package/templates/components/RichText/converter/internalLinks.tsx +45 -0
- package/templates/components/RichText/converter/textConverter.tsx +27 -0
- package/templates/components/RichText/index.tsx +35 -0
- package/templates/components/RichText/manifest.json +80 -0
|
@@ -1,252 +1,237 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import React, { useState, useCallback, useEffect } from
|
|
4
|
-
import Image from
|
|
5
|
-
import { ChevronLeft, ChevronRight } from
|
|
6
|
-
import { cn } from
|
|
7
|
-
import useEmblaCarousel from
|
|
8
|
-
|
|
9
|
-
type MediaObj = { url?: string | null; alt?: string | null }
|
|
10
|
-
|
|
11
|
-
type Slide = {
|
|
12
|
-
id?: string | null
|
|
13
|
-
title: string
|
|
14
|
-
category?: string | null
|
|
15
|
-
description?: string | null
|
|
16
|
-
image?: MediaObj | string | null
|
|
17
|
-
imageFallbackUrl?: string | null
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export type DDSliderAProps = {
|
|
21
|
-
blockType:
|
|
22
|
-
blockName?: string | null
|
|
23
|
-
eyebrow?: string | null
|
|
24
|
-
heading?: string | null
|
|
25
|
-
subtext?: string | null
|
|
26
|
-
slides?: Slide[] | null
|
|
27
|
-
sectionId?: string | null
|
|
28
|
-
customCSS?: string | null
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function isValidImageSrc(src?: string | null): src is string {
|
|
32
|
-
return Boolean(src && src.startsWith(
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function getImageSrc(slide: Slide): string {
|
|
36
|
-
const candidateSrc =
|
|
37
|
-
slide.image &&
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const
|
|
55
|
-
const [
|
|
56
|
-
const [
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
onSelect
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const
|
|
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
|
-
aria-label={`Go to slide ${i + 1}`}
|
|
239
|
-
className={cn(
|
|
240
|
-
"rounded-full transition-all duration-300 cursor-pointer",
|
|
241
|
-
i === activeIdx
|
|
242
|
-
? "w-8 h-2.5 bg-lime-500"
|
|
243
|
-
: "w-2.5 h-2.5 bg-stone-600 hover:bg-stone-400",
|
|
244
|
-
)}
|
|
245
|
-
/>
|
|
246
|
-
))}
|
|
247
|
-
</div>
|
|
248
|
-
)}
|
|
249
|
-
</div>
|
|
250
|
-
</section>
|
|
251
|
-
);
|
|
252
|
-
};
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import React, { useState, useCallback, useEffect } from 'react'
|
|
4
|
+
import Image from 'next/image'
|
|
5
|
+
import { ChevronLeft, ChevronRight } from 'lucide-react'
|
|
6
|
+
import { cn } from '@/utilities/ui'
|
|
7
|
+
import useEmblaCarousel from 'embla-carousel-react'
|
|
8
|
+
|
|
9
|
+
type MediaObj = { url?: string | null; alt?: string | null }
|
|
10
|
+
|
|
11
|
+
type Slide = {
|
|
12
|
+
id?: string | null
|
|
13
|
+
title: string
|
|
14
|
+
category?: string | null
|
|
15
|
+
description?: string | null
|
|
16
|
+
image?: MediaObj | string | null
|
|
17
|
+
imageFallbackUrl?: string | null
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type DDSliderAProps = {
|
|
21
|
+
blockType: 'DD-Slider-A'
|
|
22
|
+
blockName?: string | null
|
|
23
|
+
eyebrow?: string | null
|
|
24
|
+
heading?: string | null
|
|
25
|
+
subtext?: string | null
|
|
26
|
+
slides?: Slide[] | null
|
|
27
|
+
sectionId?: string | null
|
|
28
|
+
customCSS?: string | null
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function isValidImageSrc(src?: string | null): src is string {
|
|
32
|
+
return Boolean(src && src.startsWith('/api/media/file/'))
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function getImageSrc(slide: Slide): string {
|
|
36
|
+
const candidateSrc =
|
|
37
|
+
slide.image && typeof slide.image === 'object' && (slide.image as MediaObj).url
|
|
38
|
+
? (slide.image as MediaObj).url!
|
|
39
|
+
: (slide.imageFallbackUrl ?? '')
|
|
40
|
+
|
|
41
|
+
return isValidImageSrc(candidateSrc) ? candidateSrc : ''
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const DDSliderA: React.FC<DDSliderAProps> = ({
|
|
45
|
+
eyebrow,
|
|
46
|
+
heading,
|
|
47
|
+
subtext,
|
|
48
|
+
slides: slidesProp,
|
|
49
|
+
sectionId,
|
|
50
|
+
customCSS,
|
|
51
|
+
}) => {
|
|
52
|
+
const slides = slidesProp ?? []
|
|
53
|
+
const [emblaRef, emblaApi] = useEmblaCarousel({ loop: true })
|
|
54
|
+
const [activeIdx, setActiveIdx] = useState(0)
|
|
55
|
+
const [loadedSlides, setLoadedSlides] = useState<Record<number, boolean>>({})
|
|
56
|
+
const [loadedThumbs, setLoadedThumbs] = useState<Record<number, boolean>>({})
|
|
57
|
+
|
|
58
|
+
const onSelect = useCallback(() => {
|
|
59
|
+
if (!emblaApi) return
|
|
60
|
+
setActiveIdx(emblaApi.selectedScrollSnap())
|
|
61
|
+
}, [emblaApi])
|
|
62
|
+
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (!emblaApi) return
|
|
65
|
+
onSelect()
|
|
66
|
+
emblaApi.on('select', onSelect)
|
|
67
|
+
emblaApi.on('reInit', onSelect)
|
|
68
|
+
return () => {
|
|
69
|
+
emblaApi.off('select', onSelect)
|
|
70
|
+
emblaApi.off('reInit', onSelect)
|
|
71
|
+
}
|
|
72
|
+
}, [emblaApi, onSelect])
|
|
73
|
+
|
|
74
|
+
const scrollPrev = useCallback(() => emblaApi?.scrollPrev(), [emblaApi])
|
|
75
|
+
const scrollNext = useCallback(() => emblaApi?.scrollNext(), [emblaApi])
|
|
76
|
+
const scrollTo = useCallback((i: number) => emblaApi?.scrollTo(i), [emblaApi])
|
|
77
|
+
|
|
78
|
+
if (!slides.length) return null
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<section id={sectionId ?? undefined} className="py-20 overflow-hidden">
|
|
82
|
+
{customCSS && <style dangerouslySetInnerHTML={{ __html: customCSS }} />}
|
|
83
|
+
<div className="max-w-6xl lg:max-w-7xl mx-auto px-4 md:px-6">
|
|
84
|
+
{/* Optional section header */}
|
|
85
|
+
#BlockName-DDSliderA
|
|
86
|
+
{(eyebrow || heading || subtext) && (
|
|
87
|
+
<div className="mb-10 text-center">
|
|
88
|
+
{eyebrow && (
|
|
89
|
+
<p className="text-lime-500 text-xs font-bold uppercase tracking-widest mb-2">
|
|
90
|
+
{eyebrow}
|
|
91
|
+
</p>
|
|
92
|
+
)}
|
|
93
|
+
{heading && (
|
|
94
|
+
<h2 className="text-4xl lg:text-5xl font-bold text-stone-900 dark:text-stone-50 leading-tight">
|
|
95
|
+
{heading}
|
|
96
|
+
</h2>
|
|
97
|
+
)}
|
|
98
|
+
{subtext && (
|
|
99
|
+
<p className="text-stone-400 mt-3 text-base max-w-2xl mx-auto">{subtext}</p>
|
|
100
|
+
)}
|
|
101
|
+
</div>
|
|
102
|
+
)}
|
|
103
|
+
<div className="relative rounded-3xl overflow-hidden">
|
|
104
|
+
{/* Embla viewport */}
|
|
105
|
+
<div
|
|
106
|
+
ref={emblaRef}
|
|
107
|
+
className="overflow-hidden select-none cursor-grab active:cursor-grabbing h-[480px] lg:h-[560px]"
|
|
108
|
+
>
|
|
109
|
+
<div className="flex h-full">
|
|
110
|
+
{slides.map((slide, i) => {
|
|
111
|
+
const imgSrc = getImageSrc(slide)
|
|
112
|
+
return (
|
|
113
|
+
<div key={slide.id ?? i} className="flex-none w-full h-full relative">
|
|
114
|
+
{imgSrc ? (
|
|
115
|
+
<>
|
|
116
|
+
{!loadedSlides[i] && (
|
|
117
|
+
<div className="absolute inset-0 bg-stone-900 animate-pulse" />
|
|
118
|
+
)}
|
|
119
|
+
<Image
|
|
120
|
+
src={imgSrc}
|
|
121
|
+
alt={slide.title}
|
|
122
|
+
fill
|
|
123
|
+
sizes="100vw"
|
|
124
|
+
priority={i === 0}
|
|
125
|
+
className="w-full h-full object-cover object-top"
|
|
126
|
+
draggable={false}
|
|
127
|
+
onLoad={() => setLoadedSlides((prev) => ({ ...prev, [i]: true }))}
|
|
128
|
+
/>
|
|
129
|
+
</>
|
|
130
|
+
) : (
|
|
131
|
+
<div className="w-full h-full bg-gradient-to-br from-violet-950 to-indigo-950" />
|
|
132
|
+
)}
|
|
133
|
+
|
|
134
|
+
{/* Gradient overlay */}
|
|
135
|
+
<div className="absolute inset-0 bg-gradient-to-r from-stone-950/80 via-stone-950/40 to-transparent pointer-events-none" />
|
|
136
|
+
|
|
137
|
+
{/* Slide content */}
|
|
138
|
+
<div className="absolute bottom-0 left-0 right-0 p-8 lg:p-12 pointer-events-none">
|
|
139
|
+
<div className="max-w-lg">
|
|
140
|
+
{slide.category && (
|
|
141
|
+
<span className="inline-block bg-lime-500/50 border-lime-500 border text-stone-200 text-xs font-bold px-3 py-1 rounded-full mb-3 uppercase tracking-widest scale-90 origin-top-left">
|
|
142
|
+
{slide.category}
|
|
143
|
+
</span>
|
|
144
|
+
)}
|
|
145
|
+
<h3 className="text-stone-50 font-black text-3xl lg:text-4xl mb-3">
|
|
146
|
+
{slide.title}
|
|
147
|
+
</h3>
|
|
148
|
+
{slide.description && (
|
|
149
|
+
<p className="text-stone-50/70 text-base leading-relaxed">
|
|
150
|
+
{slide.description}
|
|
151
|
+
</p>
|
|
152
|
+
)}
|
|
153
|
+
</div>
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
)
|
|
157
|
+
})}
|
|
158
|
+
</div>
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
{/* Navigation arrows */}
|
|
162
|
+
<button
|
|
163
|
+
onClick={scrollPrev}
|
|
164
|
+
aria-label="Previous slide"
|
|
165
|
+
className="absolute left-1 top-1/2 -translate-y-1/2 z-20 w-12 h-12 flex items-center justify-center rounded-full bg-stone-50/5 hover:bg-lime-500 text-stone-50 backdrop-blur-sm transition-all cursor-pointer"
|
|
166
|
+
>
|
|
167
|
+
<ChevronLeft className="w-5 h-5" />
|
|
168
|
+
</button>
|
|
169
|
+
<button
|
|
170
|
+
onClick={scrollNext}
|
|
171
|
+
aria-label="Next slide"
|
|
172
|
+
className="absolute right-1 top-1/2 -translate-y-1/2 z-20 w-12 h-12 flex items-center justify-center rounded-full bg-stone-50/5 hover:bg-lime-500 text-stone-50 backdrop-blur-sm transition-all cursor-pointer"
|
|
173
|
+
>
|
|
174
|
+
<ChevronRight className="w-5 h-5" />
|
|
175
|
+
</button>
|
|
176
|
+
|
|
177
|
+
{/* Thumbnail strip */}
|
|
178
|
+
<div className="absolute bottom-4 right-4 lg:right-8 z-20 flex gap-2">
|
|
179
|
+
{slides.map((slide, i) => {
|
|
180
|
+
const imgSrc = getImageSrc(slide)
|
|
181
|
+
return (
|
|
182
|
+
<button
|
|
183
|
+
key={slide.id ?? i}
|
|
184
|
+
onClick={() => scrollTo(i)}
|
|
185
|
+
aria-label={`Go to slide: ${slide.title}`}
|
|
186
|
+
className={cn(
|
|
187
|
+
'relative w-16 h-12 rounded-lg overflow-hidden border-2 transition-all cursor-pointer',
|
|
188
|
+
i === activeIdx
|
|
189
|
+
? 'border-lime-500 scale-110'
|
|
190
|
+
: 'border-white/30 opacity-60 hover:opacity-100',
|
|
191
|
+
)}
|
|
192
|
+
>
|
|
193
|
+
{imgSrc ? (
|
|
194
|
+
<>
|
|
195
|
+
{!loadedThumbs[i] && (
|
|
196
|
+
<div className="absolute inset-0 bg-stone-800 animate-pulse" />
|
|
197
|
+
)}
|
|
198
|
+
<Image
|
|
199
|
+
src={imgSrc}
|
|
200
|
+
alt={slide.title}
|
|
201
|
+
fill
|
|
202
|
+
sizes="64px"
|
|
203
|
+
className="w-full h-full object-cover object-top"
|
|
204
|
+
draggable={false}
|
|
205
|
+
onLoad={() => setLoadedThumbs((prev) => ({ ...prev, [i]: true }))}
|
|
206
|
+
/>
|
|
207
|
+
</>
|
|
208
|
+
) : (
|
|
209
|
+
<div className="w-full h-full bg-stone-800" />
|
|
210
|
+
)}
|
|
211
|
+
</button>
|
|
212
|
+
)
|
|
213
|
+
})}
|
|
214
|
+
</div>
|
|
215
|
+
</div>
|
|
216
|
+
{/* Dot indicators */}
|
|
217
|
+
{slides.length > 1 && (
|
|
218
|
+
<div className="flex justify-center gap-2 mt-6">
|
|
219
|
+
{slides.map((_, i) => (
|
|
220
|
+
<button
|
|
221
|
+
key={i}
|
|
222
|
+
onClick={() => scrollTo(i)}
|
|
223
|
+
aria-label={`Go to slide ${i + 1}`}
|
|
224
|
+
className={cn(
|
|
225
|
+
'rounded-full transition-all duration-300 cursor-pointer',
|
|
226
|
+
i === activeIdx
|
|
227
|
+
? 'w-8 h-2.5 bg-lime-500'
|
|
228
|
+
: 'w-2.5 h-2.5 bg-stone-600 hover:bg-stone-400',
|
|
229
|
+
)}
|
|
230
|
+
/>
|
|
231
|
+
))}
|
|
232
|
+
</div>
|
|
233
|
+
)}
|
|
234
|
+
</div>
|
|
235
|
+
</section>
|
|
236
|
+
)
|
|
237
|
+
}
|