nextworks 0.2.0-alpha.11 → 0.2.0-alpha.13
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 +283 -282
- package/dist/cli_manifests/blocks_manifest.json +198 -175
- package/dist/kits/blocks/.nextworks/docs/BLOCKS_QUICKSTART.md +101 -100
- package/dist/kits/blocks/.nextworks/docs/BLOCKS_README.md +105 -104
- package/dist/kits/blocks/.nextworks/docs/THEME_GUIDE.md +1 -1
- package/dist/kits/blocks/app/templates/aiworkflow/PresetThemeVars.tsx +58 -0
- package/dist/kits/blocks/app/templates/aiworkflow/README.md +46 -0
- package/dist/kits/blocks/app/templates/aiworkflow/components/CTA.tsx +44 -0
- package/dist/kits/blocks/app/templates/aiworkflow/components/Contact.tsx +105 -0
- package/dist/kits/blocks/app/templates/aiworkflow/components/FAQ.tsx +63 -0
- package/dist/kits/blocks/app/templates/aiworkflow/components/Features.tsx +65 -0
- package/dist/kits/blocks/app/templates/aiworkflow/components/Footer.tsx +109 -0
- package/dist/kits/blocks/app/templates/aiworkflow/components/Hero.tsx +636 -0
- package/dist/kits/blocks/app/templates/aiworkflow/components/Navbar.tsx +90 -0
- package/dist/kits/blocks/app/templates/aiworkflow/components/Pricing.tsx +86 -0
- package/dist/kits/blocks/app/templates/aiworkflow/components/ProcessTimeline.tsx +103 -0
- package/dist/kits/blocks/app/templates/aiworkflow/components/Testimonials.tsx +56 -0
- package/dist/kits/blocks/app/templates/aiworkflow/components/TrustBadges.tsx +59 -0
- package/dist/kits/blocks/app/templates/aiworkflow/page.tsx +43 -0
- package/dist/kits/blocks/app/templates/digitalagency/PresetThemeVars.tsx +80 -80
- package/dist/kits/blocks/app/templates/digitalagency/README.md +42 -42
- package/dist/kits/blocks/app/templates/digitalagency/components/Pricing.tsx +114 -114
- package/dist/kits/blocks/app/templates/digitalagency/components/Process.tsx +59 -59
- package/dist/kits/blocks/app/templates/digitalagency/components/Services.tsx +55 -55
- package/dist/kits/blocks/app/templates/digitalagency/components/Team.tsx +28 -28
- package/dist/kits/blocks/app/templates/digitalagency/components/Testimonials.tsx +65 -65
- package/dist/kits/blocks/app/templates/digitalagency/page.tsx +38 -38
- package/dist/kits/blocks/app/templates/gallery/PresetThemeVars.tsx +84 -84
- package/dist/kits/blocks/app/templates/productlaunch/PresetThemeVars.tsx +75 -75
- package/dist/kits/blocks/app/templates/productlaunch/README.md +62 -62
- package/dist/kits/blocks/app/templates/productlaunch/components/About.tsx +84 -84
- package/dist/kits/blocks/app/templates/productlaunch/components/CTA.tsx +50 -50
- package/dist/kits/blocks/app/templates/productlaunch/components/Contact.tsx +231 -231
- package/dist/kits/blocks/app/templates/productlaunch/components/FAQ.tsx +86 -86
- package/dist/kits/blocks/app/templates/productlaunch/components/Features.tsx +83 -83
- package/dist/kits/blocks/app/templates/productlaunch/components/Footer.tsx +132 -132
- package/dist/kits/blocks/app/templates/productlaunch/components/Hero.tsx +88 -88
- package/dist/kits/blocks/app/templates/productlaunch/components/Navbar.tsx +116 -116
- package/dist/kits/blocks/app/templates/productlaunch/components/Pricing.tsx +106 -106
- package/dist/kits/blocks/app/templates/productlaunch/components/ProcessTimeline.tsx +110 -110
- package/dist/kits/blocks/app/templates/productlaunch/components/ServicesGrid.tsx +68 -68
- package/dist/kits/blocks/app/templates/productlaunch/components/Team.tsx +104 -104
- package/dist/kits/blocks/app/templates/productlaunch/components/Testimonials.tsx +90 -90
- package/dist/kits/blocks/app/templates/productlaunch/components/TrustBadges.tsx +76 -76
- package/dist/kits/blocks/app/templates/productlaunch/page.tsx +43 -43
- package/dist/kits/blocks/app/templates/saasdashboard/PresetThemeVars.tsx +80 -80
- package/dist/kits/blocks/app/templates/saasdashboard/README.md +44 -44
- package/dist/kits/blocks/app/templates/saasdashboard/components/Contact.tsx +129 -129
- package/dist/kits/blocks/app/templates/saasdashboard/components/Dashboard.tsx +293 -293
- package/dist/kits/blocks/app/templates/saasdashboard/components/FAQ.tsx +55 -55
- package/dist/kits/blocks/app/templates/saasdashboard/components/Features.tsx +90 -90
- package/dist/kits/blocks/app/templates/saasdashboard/components/Footer.tsx +77 -77
- package/dist/kits/blocks/app/templates/saasdashboard/components/Hero.tsx +104 -104
- package/dist/kits/blocks/app/templates/saasdashboard/components/Hero_mask.tsx +126 -126
- package/dist/kits/blocks/app/templates/saasdashboard/components/Navbar.tsx +117 -117
- package/dist/kits/blocks/app/templates/saasdashboard/components/Pricing.tsx +90 -90
- package/dist/kits/blocks/app/templates/saasdashboard/components/SmoothScroll.tsx +96 -96
- package/dist/kits/blocks/app/templates/saasdashboard/components/Testimonials.tsx +72 -72
- package/dist/kits/blocks/app/templates/saasdashboard/components/TrustBadges.tsx +53 -53
- package/dist/kits/blocks/app/templates/saasdashboard/page.tsx +39 -39
- package/dist/kits/blocks/components/enhanced-theme-provider.tsx +195 -195
- package/dist/kits/blocks/components/providers/BlocksAppProviders.tsx +27 -27
- package/dist/kits/blocks/components/sections/About.tsx +291 -291
- package/dist/kits/blocks/components/sections/CTA.tsx +257 -257
- package/dist/kits/blocks/components/sections/Contact.tsx +267 -267
- package/dist/kits/blocks/components/sections/FAQ.tsx +214 -214
- package/dist/kits/blocks/components/sections/Features.tsx +268 -268
- package/dist/kits/blocks/components/sections/Footer.tsx +302 -302
- package/dist/kits/blocks/components/sections/HeroMotion.tsx +308 -308
- package/dist/kits/blocks/components/sections/HeroOverlay.tsx +358 -358
- package/dist/kits/blocks/components/sections/HeroProductDemo.tsx +236 -0
- package/dist/kits/blocks/components/sections/HeroSplit.tsx +352 -352
- package/dist/kits/blocks/components/sections/Navbar.tsx +350 -350
- package/dist/kits/blocks/components/sections/PortfolioSimple.tsx +549 -549
- package/dist/kits/blocks/components/sections/Pricing.tsx +264 -264
- package/dist/kits/blocks/components/sections/ProcessTimeline.tsx +325 -325
- package/dist/kits/blocks/components/sections/ServicesGrid.tsx +210 -210
- package/dist/kits/blocks/components/sections/Team.tsx +309 -309
- package/dist/kits/blocks/components/sections/Testimonials.tsx +158 -158
- package/dist/kits/blocks/components/sections/TrustBadges.tsx +162 -162
- package/dist/kits/blocks/components/sections/product-demo/ApprovalInboxPanel.tsx +125 -0
- package/dist/kits/blocks/components/sections/product-demo/DemoStage.tsx +397 -0
- package/dist/kits/blocks/components/sections/product-demo/DemoWindow.tsx +128 -0
- package/dist/kits/blocks/components/sections/product-demo/KnowledgePanel.tsx +127 -0
- package/dist/kits/blocks/components/sections/product-demo/RunConsolePanel.tsx +150 -0
- package/dist/kits/blocks/components/sections/product-demo/WorkflowStudioPanel.tsx +191 -0
- package/dist/kits/blocks/components/sections/product-demo/types.ts +193 -0
- package/dist/kits/blocks/components/theme-provider.tsx +1 -1
- package/dist/kits/blocks/components/ui/alert-dialog.tsx +134 -134
- package/dist/kits/blocks/components/ui/brand-node.tsx +121 -121
- package/dist/kits/blocks/components/ui/button.tsx +122 -122
- package/dist/kits/blocks/components/ui/card.tsx +95 -95
- package/dist/kits/blocks/components/ui/checkbox.tsx +30 -30
- package/dist/kits/blocks/components/ui/cta-button.tsx +125 -125
- package/dist/kits/blocks/components/ui/dropdown-menu.tsx +201 -201
- package/dist/kits/blocks/components/ui/feature-card.tsx +91 -91
- package/dist/kits/blocks/components/ui/input.tsx +27 -27
- package/dist/kits/blocks/components/ui/label.tsx +29 -29
- package/dist/kits/blocks/components/ui/pricing-card.tsx +120 -120
- package/dist/kits/blocks/components/ui/select.tsx +25 -25
- package/dist/kits/blocks/components/ui/skeleton.tsx +13 -13
- package/dist/kits/blocks/components/ui/table.tsx +98 -98
- package/dist/kits/blocks/components/ui/testimonial-card.tsx +108 -108
- package/dist/kits/blocks/components/ui/textarea.tsx +26 -26
- package/dist/kits/blocks/components/ui/theme-selector.tsx +243 -243
- package/dist/kits/blocks/components/ui/theme-toggle.tsx +74 -74
- package/dist/kits/blocks/components/ui/toaster.tsx +7 -7
- package/dist/kits/blocks/lib/themes.ts +400 -400
- package/dist/kits/blocks/lib/utils.ts +6 -6
- package/dist/kits/blocks/package-deps.json +3 -3
- package/package.json +1 -1
|
@@ -1,308 +1,308 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import React from "react";
|
|
4
|
-
import Link from "next/link";
|
|
5
|
-
import { motion } from "motion/react";
|
|
6
|
-
import { Button } from "@/components/ui/button";
|
|
7
|
-
import { cn } from "@/lib/utils";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Props for the HeroMotion component.
|
|
11
|
-
*
|
|
12
|
-
* @remarks
|
|
13
|
-
* - Styling: exposes slot-style className overrides merged via cn().
|
|
14
|
-
* - Motion: controlled by enableMotion and motionOptions; respects
|
|
15
|
-
* prefers-reduced-motion by allowing disabling transforms.
|
|
16
|
-
* - Accessibility: rendered as a semantic <section> with aria-label.
|
|
17
|
-
* - CTA: primary/secondary CTA can be links (href provided) or buttons.
|
|
18
|
-
*/
|
|
19
|
-
type MotionTransition = React.ComponentProps<typeof motion.div>["transition"];
|
|
20
|
-
|
|
21
|
-
export interface HeroMotionProps {
|
|
22
|
-
/** Optional id to attach to the section root */
|
|
23
|
-
id?: string;
|
|
24
|
-
/** ARIA label for the section. @defaultValue "Hero section" */
|
|
25
|
-
ariaLabel?: string;
|
|
26
|
-
/** Optional top-level class to override the root */
|
|
27
|
-
className?: string;
|
|
28
|
-
|
|
29
|
-
/** Primary heading text. Ignored when headingNode is provided. */
|
|
30
|
-
heading?: string;
|
|
31
|
-
/** Custom heading node; use for advanced layouts or styling. */
|
|
32
|
-
headingNode?: React.ReactNode;
|
|
33
|
-
/** Inline highlight node rendered next to heading text. */
|
|
34
|
-
highlight?: React.ReactNode;
|
|
35
|
-
/** Optional description paragraph/node */
|
|
36
|
-
description?: React.ReactNode;
|
|
37
|
-
|
|
38
|
-
/** Primary call to action config or null to hide */
|
|
39
|
-
primaryCta?: { label: string; href?: string } | null;
|
|
40
|
-
/** Secondary call to action config or null to hide */
|
|
41
|
-
secondaryCta?: { label: string; href?: string } | null;
|
|
42
|
-
|
|
43
|
-
/** Slot-style overrides */
|
|
44
|
-
section?: { className?: string };
|
|
45
|
-
container?: { className?: string };
|
|
46
|
-
content?: { className?: string };
|
|
47
|
-
headingText?: { className?: string };
|
|
48
|
-
highlightText?: { className?: string };
|
|
49
|
-
descriptionText?: { className?: string };
|
|
50
|
-
actions?: { className?: string };
|
|
51
|
-
primaryButtonStyle?: {
|
|
52
|
-
unstyled?: boolean;
|
|
53
|
-
style?: React.CSSProperties;
|
|
54
|
-
variant?:
|
|
55
|
-
| "default"
|
|
56
|
-
| "destructive"
|
|
57
|
-
| "outline"
|
|
58
|
-
| "secondary"
|
|
59
|
-
| "ghost"
|
|
60
|
-
| "link";
|
|
61
|
-
size?: "default" | "sm" | "lg" | "icon";
|
|
62
|
-
className?: string;
|
|
63
|
-
};
|
|
64
|
-
secondaryButtonStyle?: {
|
|
65
|
-
unstyled?: boolean;
|
|
66
|
-
style?: React.CSSProperties;
|
|
67
|
-
variant?:
|
|
68
|
-
| "default"
|
|
69
|
-
| "destructive"
|
|
70
|
-
| "outline"
|
|
71
|
-
| "secondary"
|
|
72
|
-
| "ghost"
|
|
73
|
-
| "link";
|
|
74
|
-
size?: "default" | "sm" | "lg" | "icon";
|
|
75
|
-
className?: string;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
/** Optional background node (e.g., SVGs, gradients, images) */
|
|
79
|
-
backgroundNode?: React.ReactNode;
|
|
80
|
-
|
|
81
|
-
/** When false, disables entrance animations */
|
|
82
|
-
enableMotion?: boolean;
|
|
83
|
-
|
|
84
|
-
/** Motion configuration for entrance sequences */
|
|
85
|
-
motionOptions?: {
|
|
86
|
-
viewport?: { once?: boolean; amount?: number };
|
|
87
|
-
headingDelay?: number;
|
|
88
|
-
descriptionDelay?: number;
|
|
89
|
-
actionsDelay?: number;
|
|
90
|
-
transition: MotionTransition;
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const defaultChildTransition: MotionTransition = {
|
|
95
|
-
type: "tween",
|
|
96
|
-
duration: 0.5,
|
|
97
|
-
ease: [0.22, 1, 0.36, 1],
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Motion-first hero with heading/highlight, optional description and CTAs.
|
|
102
|
-
*
|
|
103
|
-
* @remarks
|
|
104
|
-
* - Styling: slot-style className overrides are merged after defaults via cn().
|
|
105
|
-
* - Motion: enableMotion toggles entrance transitions; motionOptions controls
|
|
106
|
-
* delays and viewport.
|
|
107
|
-
* - Accessibility: semantic <section> with aria-label.
|
|
108
|
-
*
|
|
109
|
-
* @example
|
|
110
|
-
* <HeroMotion
|
|
111
|
-
* heading="Supercharge growth with"
|
|
112
|
-
* highlight="AI-powered insights"
|
|
113
|
-
* primaryCta={{ label: 'Get Started', href: '#contact' }}
|
|
114
|
-
* />
|
|
115
|
-
*/
|
|
116
|
-
export function HeroMotion({
|
|
117
|
-
id,
|
|
118
|
-
ariaLabel = "Hero section",
|
|
119
|
-
className,
|
|
120
|
-
heading = "Supercharge growth with",
|
|
121
|
-
headingNode,
|
|
122
|
-
highlight = "AI-powered insights",
|
|
123
|
-
description = (
|
|
124
|
-
<>
|
|
125
|
-
Real-time trends, accurate user signals, and smarter, data-driven
|
|
126
|
-
decisions.
|
|
127
|
-
</>
|
|
128
|
-
),
|
|
129
|
-
primaryCta = { label: "Get Started" },
|
|
130
|
-
secondaryCta = { label: "See Demo" },
|
|
131
|
-
section = { className: "bg-background relative overflow-hidden" },
|
|
132
|
-
container = { className: "mx-auto max-w-7xl px-6 py-24 sm:py-28 lg:py-32" },
|
|
133
|
-
content = { className: "mx-auto max-w-3xl text-center" },
|
|
134
|
-
headingText = {
|
|
135
|
-
className:
|
|
136
|
-
"transform-gpu will-change-transform text-foreground text-4xl font-semibold tracking-tight text-balance sm:text-5xl md:text-6xl",
|
|
137
|
-
},
|
|
138
|
-
highlightText = {
|
|
139
|
-
className:
|
|
140
|
-
"from-primary via-primary/80 to-primary/60 bg-gradient-to-r bg-clip-text text-transparent",
|
|
141
|
-
},
|
|
142
|
-
descriptionText = {
|
|
143
|
-
className:
|
|
144
|
-
"transform-gpu will-change-transform text-muted-foreground mt-5 text-base text-pretty sm:text-lg",
|
|
145
|
-
},
|
|
146
|
-
actions = { className: "mt-8 flex items-center justify-center gap-3" },
|
|
147
|
-
primaryButtonStyle = { size: "lg", variant: "default", className: "" },
|
|
148
|
-
secondaryButtonStyle = { size: "lg", variant: "outline", className: "" },
|
|
149
|
-
enableMotion = true,
|
|
150
|
-
motionOptions = {
|
|
151
|
-
viewport: { once: true, amount: 0.25 },
|
|
152
|
-
headingDelay: 0.5,
|
|
153
|
-
descriptionDelay: 0.58,
|
|
154
|
-
actionsDelay: 0.66,
|
|
155
|
-
transition: defaultChildTransition,
|
|
156
|
-
},
|
|
157
|
-
backgroundNode,
|
|
158
|
-
}: HeroMotionProps) {
|
|
159
|
-
const viewport = enableMotion
|
|
160
|
-
? {
|
|
161
|
-
once: motionOptions?.viewport?.once ?? true,
|
|
162
|
-
amount: motionOptions?.viewport?.amount ?? 0.25,
|
|
163
|
-
}
|
|
164
|
-
: { once: true, amount: 0 };
|
|
165
|
-
|
|
166
|
-
const transition: MotionTransition = {
|
|
167
|
-
...defaultChildTransition,
|
|
168
|
-
...(motionOptions?.transition ?? {}),
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
return (
|
|
172
|
-
<section
|
|
173
|
-
id={id}
|
|
174
|
-
aria-label={ariaLabel}
|
|
175
|
-
className={cn(section.className, className)}
|
|
176
|
-
>
|
|
177
|
-
{backgroundNode}
|
|
178
|
-
<div className={cn(container.className)}>
|
|
179
|
-
<motion.div className={cn(content.className)}>
|
|
180
|
-
<motion.h1
|
|
181
|
-
initial={
|
|
182
|
-
enableMotion ? { opacity: 0, y: 12 } : { opacity: 1, y: 0 }
|
|
183
|
-
}
|
|
184
|
-
whileInView={{ opacity: 1, y: 0 }}
|
|
185
|
-
viewport={viewport}
|
|
186
|
-
transition={
|
|
187
|
-
enableMotion
|
|
188
|
-
? { ...transition, delay: motionOptions?.headingDelay ?? 0.5 }
|
|
189
|
-
: { type: "tween", duration: 0 }
|
|
190
|
-
}
|
|
191
|
-
className={cn(headingText.className)}
|
|
192
|
-
>
|
|
193
|
-
{headingNode ? (
|
|
194
|
-
headingNode
|
|
195
|
-
) : (
|
|
196
|
-
<>
|
|
197
|
-
{heading}
|
|
198
|
-
{highlight ? (
|
|
199
|
-
<span className={cn(highlightText.className)}>
|
|
200
|
-
{" "}
|
|
201
|
-
{highlight}
|
|
202
|
-
</span>
|
|
203
|
-
) : null}
|
|
204
|
-
</>
|
|
205
|
-
)}
|
|
206
|
-
</motion.h1>
|
|
207
|
-
|
|
208
|
-
{description ? (
|
|
209
|
-
<motion.p
|
|
210
|
-
initial={
|
|
211
|
-
enableMotion ? { opacity: 0, y: 10 } : { opacity: 1, y: 0 }
|
|
212
|
-
}
|
|
213
|
-
whileInView={{ opacity: 1, y: 0 }}
|
|
214
|
-
viewport={viewport}
|
|
215
|
-
transition={
|
|
216
|
-
enableMotion
|
|
217
|
-
? {
|
|
218
|
-
...transition,
|
|
219
|
-
delay: motionOptions?.descriptionDelay ?? 0.58,
|
|
220
|
-
}
|
|
221
|
-
: { type: "tween", duration: 0 }
|
|
222
|
-
}
|
|
223
|
-
className={cn(descriptionText.className)}
|
|
224
|
-
>
|
|
225
|
-
{description}
|
|
226
|
-
</motion.p>
|
|
227
|
-
) : null}
|
|
228
|
-
|
|
229
|
-
{(primaryCta || secondaryCta) && (
|
|
230
|
-
<motion.div
|
|
231
|
-
initial={
|
|
232
|
-
enableMotion ? { opacity: 0, y: 10 } : { opacity: 1, y: 0 }
|
|
233
|
-
}
|
|
234
|
-
whileInView={{ opacity: 1, y: 0 }}
|
|
235
|
-
viewport={viewport}
|
|
236
|
-
transition={
|
|
237
|
-
enableMotion
|
|
238
|
-
? {
|
|
239
|
-
...transition,
|
|
240
|
-
delay: motionOptions?.actionsDelay ?? 0.66,
|
|
241
|
-
}
|
|
242
|
-
: { type: "tween", duration: 0 }
|
|
243
|
-
}
|
|
244
|
-
className={cn(actions.className)}
|
|
245
|
-
>
|
|
246
|
-
{primaryCta &&
|
|
247
|
-
(primaryCta.href ? (
|
|
248
|
-
<Button
|
|
249
|
-
asChild
|
|
250
|
-
unstyled={primaryButtonStyle.unstyled}
|
|
251
|
-
variant={primaryButtonStyle.variant}
|
|
252
|
-
size={primaryButtonStyle.size}
|
|
253
|
-
className={cn(primaryButtonStyle.className)}
|
|
254
|
-
style={primaryButtonStyle.style}
|
|
255
|
-
>
|
|
256
|
-
<Link href={primaryCta.href} aria-label={primaryCta.label}>
|
|
257
|
-
{primaryCta.label}
|
|
258
|
-
</Link>
|
|
259
|
-
</Button>
|
|
260
|
-
) : (
|
|
261
|
-
<Button
|
|
262
|
-
variant={primaryButtonStyle.variant}
|
|
263
|
-
size={primaryButtonStyle.size}
|
|
264
|
-
className={cn(primaryButtonStyle.className)}
|
|
265
|
-
unstyled={primaryButtonStyle.unstyled}
|
|
266
|
-
style={primaryButtonStyle.style}
|
|
267
|
-
aria-label={primaryCta.label}
|
|
268
|
-
>
|
|
269
|
-
{primaryCta.label}
|
|
270
|
-
</Button>
|
|
271
|
-
))}
|
|
272
|
-
|
|
273
|
-
{secondaryCta &&
|
|
274
|
-
(secondaryCta.href ? (
|
|
275
|
-
<Button
|
|
276
|
-
asChild
|
|
277
|
-
unstyled={secondaryButtonStyle.unstyled}
|
|
278
|
-
variant={secondaryButtonStyle.variant}
|
|
279
|
-
size={secondaryButtonStyle.size}
|
|
280
|
-
className={cn(secondaryButtonStyle.className)}
|
|
281
|
-
style={secondaryButtonStyle.style}
|
|
282
|
-
>
|
|
283
|
-
<Link
|
|
284
|
-
href={secondaryCta.href}
|
|
285
|
-
aria-label={secondaryCta.label}
|
|
286
|
-
>
|
|
287
|
-
{secondaryCta.label}
|
|
288
|
-
</Link>
|
|
289
|
-
</Button>
|
|
290
|
-
) : (
|
|
291
|
-
<Button
|
|
292
|
-
variant={secondaryButtonStyle.variant}
|
|
293
|
-
size={secondaryButtonStyle.size}
|
|
294
|
-
className={cn(secondaryButtonStyle.className)}
|
|
295
|
-
unstyled={secondaryButtonStyle.unstyled}
|
|
296
|
-
style={secondaryButtonStyle.style}
|
|
297
|
-
aria-label={secondaryCta.label}
|
|
298
|
-
>
|
|
299
|
-
{secondaryCta.label}
|
|
300
|
-
</Button>
|
|
301
|
-
))}
|
|
302
|
-
</motion.div>
|
|
303
|
-
)}
|
|
304
|
-
</motion.div>
|
|
305
|
-
</div>
|
|
306
|
-
</section>
|
|
307
|
-
);
|
|
308
|
-
}
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import Link from "next/link";
|
|
5
|
+
import { motion } from "motion/react";
|
|
6
|
+
import { Button } from "@/components/ui/button";
|
|
7
|
+
import { cn } from "@/lib/utils";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Props for the HeroMotion component.
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* - Styling: exposes slot-style className overrides merged via cn().
|
|
14
|
+
* - Motion: controlled by enableMotion and motionOptions; respects
|
|
15
|
+
* prefers-reduced-motion by allowing disabling transforms.
|
|
16
|
+
* - Accessibility: rendered as a semantic <section> with aria-label.
|
|
17
|
+
* - CTA: primary/secondary CTA can be links (href provided) or buttons.
|
|
18
|
+
*/
|
|
19
|
+
type MotionTransition = React.ComponentProps<typeof motion.div>["transition"];
|
|
20
|
+
|
|
21
|
+
export interface HeroMotionProps {
|
|
22
|
+
/** Optional id to attach to the section root */
|
|
23
|
+
id?: string;
|
|
24
|
+
/** ARIA label for the section. @defaultValue "Hero section" */
|
|
25
|
+
ariaLabel?: string;
|
|
26
|
+
/** Optional top-level class to override the root */
|
|
27
|
+
className?: string;
|
|
28
|
+
|
|
29
|
+
/** Primary heading text. Ignored when headingNode is provided. */
|
|
30
|
+
heading?: string;
|
|
31
|
+
/** Custom heading node; use for advanced layouts or styling. */
|
|
32
|
+
headingNode?: React.ReactNode;
|
|
33
|
+
/** Inline highlight node rendered next to heading text. */
|
|
34
|
+
highlight?: React.ReactNode;
|
|
35
|
+
/** Optional description paragraph/node */
|
|
36
|
+
description?: React.ReactNode;
|
|
37
|
+
|
|
38
|
+
/** Primary call to action config or null to hide */
|
|
39
|
+
primaryCta?: { label: string; href?: string } | null;
|
|
40
|
+
/** Secondary call to action config or null to hide */
|
|
41
|
+
secondaryCta?: { label: string; href?: string } | null;
|
|
42
|
+
|
|
43
|
+
/** Slot-style overrides */
|
|
44
|
+
section?: { className?: string };
|
|
45
|
+
container?: { className?: string };
|
|
46
|
+
content?: { className?: string };
|
|
47
|
+
headingText?: { className?: string };
|
|
48
|
+
highlightText?: { className?: string };
|
|
49
|
+
descriptionText?: { className?: string };
|
|
50
|
+
actions?: { className?: string };
|
|
51
|
+
primaryButtonStyle?: {
|
|
52
|
+
unstyled?: boolean;
|
|
53
|
+
style?: React.CSSProperties;
|
|
54
|
+
variant?:
|
|
55
|
+
| "default"
|
|
56
|
+
| "destructive"
|
|
57
|
+
| "outline"
|
|
58
|
+
| "secondary"
|
|
59
|
+
| "ghost"
|
|
60
|
+
| "link";
|
|
61
|
+
size?: "default" | "sm" | "lg" | "icon";
|
|
62
|
+
className?: string;
|
|
63
|
+
};
|
|
64
|
+
secondaryButtonStyle?: {
|
|
65
|
+
unstyled?: boolean;
|
|
66
|
+
style?: React.CSSProperties;
|
|
67
|
+
variant?:
|
|
68
|
+
| "default"
|
|
69
|
+
| "destructive"
|
|
70
|
+
| "outline"
|
|
71
|
+
| "secondary"
|
|
72
|
+
| "ghost"
|
|
73
|
+
| "link";
|
|
74
|
+
size?: "default" | "sm" | "lg" | "icon";
|
|
75
|
+
className?: string;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/** Optional background node (e.g., SVGs, gradients, images) */
|
|
79
|
+
backgroundNode?: React.ReactNode;
|
|
80
|
+
|
|
81
|
+
/** When false, disables entrance animations */
|
|
82
|
+
enableMotion?: boolean;
|
|
83
|
+
|
|
84
|
+
/** Motion configuration for entrance sequences */
|
|
85
|
+
motionOptions?: {
|
|
86
|
+
viewport?: { once?: boolean; amount?: number };
|
|
87
|
+
headingDelay?: number;
|
|
88
|
+
descriptionDelay?: number;
|
|
89
|
+
actionsDelay?: number;
|
|
90
|
+
transition: MotionTransition;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const defaultChildTransition: MotionTransition = {
|
|
95
|
+
type: "tween",
|
|
96
|
+
duration: 0.5,
|
|
97
|
+
ease: [0.22, 1, 0.36, 1],
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Motion-first hero with heading/highlight, optional description and CTAs.
|
|
102
|
+
*
|
|
103
|
+
* @remarks
|
|
104
|
+
* - Styling: slot-style className overrides are merged after defaults via cn().
|
|
105
|
+
* - Motion: enableMotion toggles entrance transitions; motionOptions controls
|
|
106
|
+
* delays and viewport.
|
|
107
|
+
* - Accessibility: semantic <section> with aria-label.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* <HeroMotion
|
|
111
|
+
* heading="Supercharge growth with"
|
|
112
|
+
* highlight="AI-powered insights"
|
|
113
|
+
* primaryCta={{ label: 'Get Started', href: '#contact' }}
|
|
114
|
+
* />
|
|
115
|
+
*/
|
|
116
|
+
export function HeroMotion({
|
|
117
|
+
id,
|
|
118
|
+
ariaLabel = "Hero section",
|
|
119
|
+
className,
|
|
120
|
+
heading = "Supercharge growth with",
|
|
121
|
+
headingNode,
|
|
122
|
+
highlight = "AI-powered insights",
|
|
123
|
+
description = (
|
|
124
|
+
<>
|
|
125
|
+
Real-time trends, accurate user signals, and smarter, data-driven
|
|
126
|
+
decisions.
|
|
127
|
+
</>
|
|
128
|
+
),
|
|
129
|
+
primaryCta = { label: "Get Started" },
|
|
130
|
+
secondaryCta = { label: "See Demo" },
|
|
131
|
+
section = { className: "bg-background relative overflow-hidden" },
|
|
132
|
+
container = { className: "mx-auto max-w-7xl px-6 py-24 sm:py-28 lg:py-32" },
|
|
133
|
+
content = { className: "mx-auto max-w-3xl text-center" },
|
|
134
|
+
headingText = {
|
|
135
|
+
className:
|
|
136
|
+
"transform-gpu will-change-transform text-foreground text-4xl font-semibold tracking-tight text-balance sm:text-5xl md:text-6xl",
|
|
137
|
+
},
|
|
138
|
+
highlightText = {
|
|
139
|
+
className:
|
|
140
|
+
"from-primary via-primary/80 to-primary/60 bg-gradient-to-r bg-clip-text text-transparent",
|
|
141
|
+
},
|
|
142
|
+
descriptionText = {
|
|
143
|
+
className:
|
|
144
|
+
"transform-gpu will-change-transform text-muted-foreground mt-5 text-base text-pretty sm:text-lg",
|
|
145
|
+
},
|
|
146
|
+
actions = { className: "mt-8 flex items-center justify-center gap-3" },
|
|
147
|
+
primaryButtonStyle = { size: "lg", variant: "default", className: "" },
|
|
148
|
+
secondaryButtonStyle = { size: "lg", variant: "outline", className: "" },
|
|
149
|
+
enableMotion = true,
|
|
150
|
+
motionOptions = {
|
|
151
|
+
viewport: { once: true, amount: 0.25 },
|
|
152
|
+
headingDelay: 0.5,
|
|
153
|
+
descriptionDelay: 0.58,
|
|
154
|
+
actionsDelay: 0.66,
|
|
155
|
+
transition: defaultChildTransition,
|
|
156
|
+
},
|
|
157
|
+
backgroundNode,
|
|
158
|
+
}: HeroMotionProps) {
|
|
159
|
+
const viewport = enableMotion
|
|
160
|
+
? {
|
|
161
|
+
once: motionOptions?.viewport?.once ?? true,
|
|
162
|
+
amount: motionOptions?.viewport?.amount ?? 0.25,
|
|
163
|
+
}
|
|
164
|
+
: { once: true, amount: 0 };
|
|
165
|
+
|
|
166
|
+
const transition: MotionTransition = {
|
|
167
|
+
...defaultChildTransition,
|
|
168
|
+
...(motionOptions?.transition ?? {}),
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
return (
|
|
172
|
+
<section
|
|
173
|
+
id={id}
|
|
174
|
+
aria-label={ariaLabel}
|
|
175
|
+
className={cn(section.className, className)}
|
|
176
|
+
>
|
|
177
|
+
{backgroundNode}
|
|
178
|
+
<div className={cn(container.className)}>
|
|
179
|
+
<motion.div className={cn(content.className)}>
|
|
180
|
+
<motion.h1
|
|
181
|
+
initial={
|
|
182
|
+
enableMotion ? { opacity: 0, y: 12 } : { opacity: 1, y: 0 }
|
|
183
|
+
}
|
|
184
|
+
whileInView={{ opacity: 1, y: 0 }}
|
|
185
|
+
viewport={viewport}
|
|
186
|
+
transition={
|
|
187
|
+
enableMotion
|
|
188
|
+
? { ...transition, delay: motionOptions?.headingDelay ?? 0.5 }
|
|
189
|
+
: { type: "tween", duration: 0 }
|
|
190
|
+
}
|
|
191
|
+
className={cn(headingText.className)}
|
|
192
|
+
>
|
|
193
|
+
{headingNode ? (
|
|
194
|
+
headingNode
|
|
195
|
+
) : (
|
|
196
|
+
<>
|
|
197
|
+
{heading}
|
|
198
|
+
{highlight ? (
|
|
199
|
+
<span className={cn(highlightText.className)}>
|
|
200
|
+
{" "}
|
|
201
|
+
{highlight}
|
|
202
|
+
</span>
|
|
203
|
+
) : null}
|
|
204
|
+
</>
|
|
205
|
+
)}
|
|
206
|
+
</motion.h1>
|
|
207
|
+
|
|
208
|
+
{description ? (
|
|
209
|
+
<motion.p
|
|
210
|
+
initial={
|
|
211
|
+
enableMotion ? { opacity: 0, y: 10 } : { opacity: 1, y: 0 }
|
|
212
|
+
}
|
|
213
|
+
whileInView={{ opacity: 1, y: 0 }}
|
|
214
|
+
viewport={viewport}
|
|
215
|
+
transition={
|
|
216
|
+
enableMotion
|
|
217
|
+
? {
|
|
218
|
+
...transition,
|
|
219
|
+
delay: motionOptions?.descriptionDelay ?? 0.58,
|
|
220
|
+
}
|
|
221
|
+
: { type: "tween", duration: 0 }
|
|
222
|
+
}
|
|
223
|
+
className={cn(descriptionText.className)}
|
|
224
|
+
>
|
|
225
|
+
{description}
|
|
226
|
+
</motion.p>
|
|
227
|
+
) : null}
|
|
228
|
+
|
|
229
|
+
{(primaryCta || secondaryCta) && (
|
|
230
|
+
<motion.div
|
|
231
|
+
initial={
|
|
232
|
+
enableMotion ? { opacity: 0, y: 10 } : { opacity: 1, y: 0 }
|
|
233
|
+
}
|
|
234
|
+
whileInView={{ opacity: 1, y: 0 }}
|
|
235
|
+
viewport={viewport}
|
|
236
|
+
transition={
|
|
237
|
+
enableMotion
|
|
238
|
+
? {
|
|
239
|
+
...transition,
|
|
240
|
+
delay: motionOptions?.actionsDelay ?? 0.66,
|
|
241
|
+
}
|
|
242
|
+
: { type: "tween", duration: 0 }
|
|
243
|
+
}
|
|
244
|
+
className={cn(actions.className)}
|
|
245
|
+
>
|
|
246
|
+
{primaryCta &&
|
|
247
|
+
(primaryCta.href ? (
|
|
248
|
+
<Button
|
|
249
|
+
asChild
|
|
250
|
+
unstyled={primaryButtonStyle.unstyled}
|
|
251
|
+
variant={primaryButtonStyle.variant}
|
|
252
|
+
size={primaryButtonStyle.size}
|
|
253
|
+
className={cn(primaryButtonStyle.className)}
|
|
254
|
+
style={primaryButtonStyle.style}
|
|
255
|
+
>
|
|
256
|
+
<Link href={primaryCta.href} aria-label={primaryCta.label}>
|
|
257
|
+
{primaryCta.label}
|
|
258
|
+
</Link>
|
|
259
|
+
</Button>
|
|
260
|
+
) : (
|
|
261
|
+
<Button
|
|
262
|
+
variant={primaryButtonStyle.variant}
|
|
263
|
+
size={primaryButtonStyle.size}
|
|
264
|
+
className={cn(primaryButtonStyle.className)}
|
|
265
|
+
unstyled={primaryButtonStyle.unstyled}
|
|
266
|
+
style={primaryButtonStyle.style}
|
|
267
|
+
aria-label={primaryCta.label}
|
|
268
|
+
>
|
|
269
|
+
{primaryCta.label}
|
|
270
|
+
</Button>
|
|
271
|
+
))}
|
|
272
|
+
|
|
273
|
+
{secondaryCta &&
|
|
274
|
+
(secondaryCta.href ? (
|
|
275
|
+
<Button
|
|
276
|
+
asChild
|
|
277
|
+
unstyled={secondaryButtonStyle.unstyled}
|
|
278
|
+
variant={secondaryButtonStyle.variant}
|
|
279
|
+
size={secondaryButtonStyle.size}
|
|
280
|
+
className={cn(secondaryButtonStyle.className)}
|
|
281
|
+
style={secondaryButtonStyle.style}
|
|
282
|
+
>
|
|
283
|
+
<Link
|
|
284
|
+
href={secondaryCta.href}
|
|
285
|
+
aria-label={secondaryCta.label}
|
|
286
|
+
>
|
|
287
|
+
{secondaryCta.label}
|
|
288
|
+
</Link>
|
|
289
|
+
</Button>
|
|
290
|
+
) : (
|
|
291
|
+
<Button
|
|
292
|
+
variant={secondaryButtonStyle.variant}
|
|
293
|
+
size={secondaryButtonStyle.size}
|
|
294
|
+
className={cn(secondaryButtonStyle.className)}
|
|
295
|
+
unstyled={secondaryButtonStyle.unstyled}
|
|
296
|
+
style={secondaryButtonStyle.style}
|
|
297
|
+
aria-label={secondaryCta.label}
|
|
298
|
+
>
|
|
299
|
+
{secondaryCta.label}
|
|
300
|
+
</Button>
|
|
301
|
+
))}
|
|
302
|
+
</motion.div>
|
|
303
|
+
)}
|
|
304
|
+
</motion.div>
|
|
305
|
+
</div>
|
|
306
|
+
</section>
|
|
307
|
+
);
|
|
308
|
+
}
|