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.
Files changed (111) hide show
  1. package/README.md +283 -282
  2. package/dist/cli_manifests/blocks_manifest.json +198 -175
  3. package/dist/kits/blocks/.nextworks/docs/BLOCKS_QUICKSTART.md +101 -100
  4. package/dist/kits/blocks/.nextworks/docs/BLOCKS_README.md +105 -104
  5. package/dist/kits/blocks/.nextworks/docs/THEME_GUIDE.md +1 -1
  6. package/dist/kits/blocks/app/templates/aiworkflow/PresetThemeVars.tsx +58 -0
  7. package/dist/kits/blocks/app/templates/aiworkflow/README.md +46 -0
  8. package/dist/kits/blocks/app/templates/aiworkflow/components/CTA.tsx +44 -0
  9. package/dist/kits/blocks/app/templates/aiworkflow/components/Contact.tsx +105 -0
  10. package/dist/kits/blocks/app/templates/aiworkflow/components/FAQ.tsx +63 -0
  11. package/dist/kits/blocks/app/templates/aiworkflow/components/Features.tsx +65 -0
  12. package/dist/kits/blocks/app/templates/aiworkflow/components/Footer.tsx +109 -0
  13. package/dist/kits/blocks/app/templates/aiworkflow/components/Hero.tsx +636 -0
  14. package/dist/kits/blocks/app/templates/aiworkflow/components/Navbar.tsx +90 -0
  15. package/dist/kits/blocks/app/templates/aiworkflow/components/Pricing.tsx +86 -0
  16. package/dist/kits/blocks/app/templates/aiworkflow/components/ProcessTimeline.tsx +103 -0
  17. package/dist/kits/blocks/app/templates/aiworkflow/components/Testimonials.tsx +56 -0
  18. package/dist/kits/blocks/app/templates/aiworkflow/components/TrustBadges.tsx +59 -0
  19. package/dist/kits/blocks/app/templates/aiworkflow/page.tsx +43 -0
  20. package/dist/kits/blocks/app/templates/digitalagency/PresetThemeVars.tsx +80 -80
  21. package/dist/kits/blocks/app/templates/digitalagency/README.md +42 -42
  22. package/dist/kits/blocks/app/templates/digitalagency/components/Pricing.tsx +114 -114
  23. package/dist/kits/blocks/app/templates/digitalagency/components/Process.tsx +59 -59
  24. package/dist/kits/blocks/app/templates/digitalagency/components/Services.tsx +55 -55
  25. package/dist/kits/blocks/app/templates/digitalagency/components/Team.tsx +28 -28
  26. package/dist/kits/blocks/app/templates/digitalagency/components/Testimonials.tsx +65 -65
  27. package/dist/kits/blocks/app/templates/digitalagency/page.tsx +38 -38
  28. package/dist/kits/blocks/app/templates/gallery/PresetThemeVars.tsx +84 -84
  29. package/dist/kits/blocks/app/templates/productlaunch/PresetThemeVars.tsx +75 -75
  30. package/dist/kits/blocks/app/templates/productlaunch/README.md +62 -62
  31. package/dist/kits/blocks/app/templates/productlaunch/components/About.tsx +84 -84
  32. package/dist/kits/blocks/app/templates/productlaunch/components/CTA.tsx +50 -50
  33. package/dist/kits/blocks/app/templates/productlaunch/components/Contact.tsx +231 -231
  34. package/dist/kits/blocks/app/templates/productlaunch/components/FAQ.tsx +86 -86
  35. package/dist/kits/blocks/app/templates/productlaunch/components/Features.tsx +83 -83
  36. package/dist/kits/blocks/app/templates/productlaunch/components/Footer.tsx +132 -132
  37. package/dist/kits/blocks/app/templates/productlaunch/components/Hero.tsx +88 -88
  38. package/dist/kits/blocks/app/templates/productlaunch/components/Navbar.tsx +116 -116
  39. package/dist/kits/blocks/app/templates/productlaunch/components/Pricing.tsx +106 -106
  40. package/dist/kits/blocks/app/templates/productlaunch/components/ProcessTimeline.tsx +110 -110
  41. package/dist/kits/blocks/app/templates/productlaunch/components/ServicesGrid.tsx +68 -68
  42. package/dist/kits/blocks/app/templates/productlaunch/components/Team.tsx +104 -104
  43. package/dist/kits/blocks/app/templates/productlaunch/components/Testimonials.tsx +90 -90
  44. package/dist/kits/blocks/app/templates/productlaunch/components/TrustBadges.tsx +76 -76
  45. package/dist/kits/blocks/app/templates/productlaunch/page.tsx +43 -43
  46. package/dist/kits/blocks/app/templates/saasdashboard/PresetThemeVars.tsx +80 -80
  47. package/dist/kits/blocks/app/templates/saasdashboard/README.md +44 -44
  48. package/dist/kits/blocks/app/templates/saasdashboard/components/Contact.tsx +129 -129
  49. package/dist/kits/blocks/app/templates/saasdashboard/components/Dashboard.tsx +293 -293
  50. package/dist/kits/blocks/app/templates/saasdashboard/components/FAQ.tsx +55 -55
  51. package/dist/kits/blocks/app/templates/saasdashboard/components/Features.tsx +90 -90
  52. package/dist/kits/blocks/app/templates/saasdashboard/components/Footer.tsx +77 -77
  53. package/dist/kits/blocks/app/templates/saasdashboard/components/Hero.tsx +104 -104
  54. package/dist/kits/blocks/app/templates/saasdashboard/components/Hero_mask.tsx +126 -126
  55. package/dist/kits/blocks/app/templates/saasdashboard/components/Navbar.tsx +117 -117
  56. package/dist/kits/blocks/app/templates/saasdashboard/components/Pricing.tsx +90 -90
  57. package/dist/kits/blocks/app/templates/saasdashboard/components/SmoothScroll.tsx +96 -96
  58. package/dist/kits/blocks/app/templates/saasdashboard/components/Testimonials.tsx +72 -72
  59. package/dist/kits/blocks/app/templates/saasdashboard/components/TrustBadges.tsx +53 -53
  60. package/dist/kits/blocks/app/templates/saasdashboard/page.tsx +39 -39
  61. package/dist/kits/blocks/components/enhanced-theme-provider.tsx +195 -195
  62. package/dist/kits/blocks/components/providers/BlocksAppProviders.tsx +27 -27
  63. package/dist/kits/blocks/components/sections/About.tsx +291 -291
  64. package/dist/kits/blocks/components/sections/CTA.tsx +257 -257
  65. package/dist/kits/blocks/components/sections/Contact.tsx +267 -267
  66. package/dist/kits/blocks/components/sections/FAQ.tsx +214 -214
  67. package/dist/kits/blocks/components/sections/Features.tsx +268 -268
  68. package/dist/kits/blocks/components/sections/Footer.tsx +302 -302
  69. package/dist/kits/blocks/components/sections/HeroMotion.tsx +308 -308
  70. package/dist/kits/blocks/components/sections/HeroOverlay.tsx +358 -358
  71. package/dist/kits/blocks/components/sections/HeroProductDemo.tsx +236 -0
  72. package/dist/kits/blocks/components/sections/HeroSplit.tsx +352 -352
  73. package/dist/kits/blocks/components/sections/Navbar.tsx +350 -350
  74. package/dist/kits/blocks/components/sections/PortfolioSimple.tsx +549 -549
  75. package/dist/kits/blocks/components/sections/Pricing.tsx +264 -264
  76. package/dist/kits/blocks/components/sections/ProcessTimeline.tsx +325 -325
  77. package/dist/kits/blocks/components/sections/ServicesGrid.tsx +210 -210
  78. package/dist/kits/blocks/components/sections/Team.tsx +309 -309
  79. package/dist/kits/blocks/components/sections/Testimonials.tsx +158 -158
  80. package/dist/kits/blocks/components/sections/TrustBadges.tsx +162 -162
  81. package/dist/kits/blocks/components/sections/product-demo/ApprovalInboxPanel.tsx +125 -0
  82. package/dist/kits/blocks/components/sections/product-demo/DemoStage.tsx +397 -0
  83. package/dist/kits/blocks/components/sections/product-demo/DemoWindow.tsx +128 -0
  84. package/dist/kits/blocks/components/sections/product-demo/KnowledgePanel.tsx +127 -0
  85. package/dist/kits/blocks/components/sections/product-demo/RunConsolePanel.tsx +150 -0
  86. package/dist/kits/blocks/components/sections/product-demo/WorkflowStudioPanel.tsx +191 -0
  87. package/dist/kits/blocks/components/sections/product-demo/types.ts +193 -0
  88. package/dist/kits/blocks/components/theme-provider.tsx +1 -1
  89. package/dist/kits/blocks/components/ui/alert-dialog.tsx +134 -134
  90. package/dist/kits/blocks/components/ui/brand-node.tsx +121 -121
  91. package/dist/kits/blocks/components/ui/button.tsx +122 -122
  92. package/dist/kits/blocks/components/ui/card.tsx +95 -95
  93. package/dist/kits/blocks/components/ui/checkbox.tsx +30 -30
  94. package/dist/kits/blocks/components/ui/cta-button.tsx +125 -125
  95. package/dist/kits/blocks/components/ui/dropdown-menu.tsx +201 -201
  96. package/dist/kits/blocks/components/ui/feature-card.tsx +91 -91
  97. package/dist/kits/blocks/components/ui/input.tsx +27 -27
  98. package/dist/kits/blocks/components/ui/label.tsx +29 -29
  99. package/dist/kits/blocks/components/ui/pricing-card.tsx +120 -120
  100. package/dist/kits/blocks/components/ui/select.tsx +25 -25
  101. package/dist/kits/blocks/components/ui/skeleton.tsx +13 -13
  102. package/dist/kits/blocks/components/ui/table.tsx +98 -98
  103. package/dist/kits/blocks/components/ui/testimonial-card.tsx +108 -108
  104. package/dist/kits/blocks/components/ui/textarea.tsx +26 -26
  105. package/dist/kits/blocks/components/ui/theme-selector.tsx +243 -243
  106. package/dist/kits/blocks/components/ui/theme-toggle.tsx +74 -74
  107. package/dist/kits/blocks/components/ui/toaster.tsx +7 -7
  108. package/dist/kits/blocks/lib/themes.ts +400 -400
  109. package/dist/kits/blocks/lib/utils.ts +6 -6
  110. package/dist/kits/blocks/package-deps.json +3 -3
  111. package/package.json +1 -1
@@ -1,291 +1,291 @@
1
- "use client";
2
-
3
- import React from "react";
4
- import { cn } from "@/lib/utils";
5
-
6
- /**
7
- * Data used to render a single statistic in the About section.
8
- *
9
- * @remarks
10
- * Typical examples include counts like projects completed or years of
11
- * experience. The suffix lets you append symbols such as "+", "%", or "/7".
12
- *
13
- * @public
14
- */
15
- export interface AboutStatData {
16
- /** The main numeric/text value (e.g., "50") */
17
- value?: string;
18
- /** Short label describing the stat (e.g., "Successful Projects") */
19
- label?: string;
20
- /** Optional suffix appended to the value (e.g., "+") */
21
- suffix?: string;
22
- }
23
-
24
- /**
25
- * Props for the About section component.
26
- *
27
- * @remarks
28
- * - Styling: exposes slot-style className overrides (section, container,
29
- * inner, contentContainer, contentStack, subheading, heading, content,
30
- * statsSection, statsGrid, statItem, statNumber, statLabel). Consumer
31
- * classes are merged after defaults via cn().
32
- * - Layout: text alignment can be set via aboutTextAlign.
33
- * - Motion: animateStats enables a count-up animation for numeric stats on first viewport visibility.
34
- * - Accessibility: rendered as a semantic <section> with aria-label.
35
- */
36
- interface AboutProps {
37
- /** Main heading text displayed in the section header. @defaultValue "Your Success Is Our Mission" */
38
- aboutHeadingText?: string;
39
- /** Optional subheading text displayed above the heading. */
40
- aboutSubheadingText?: string;
41
- /** Primary paragraph/content body. @defaultValue a short marketing blurb */
42
- aboutContentText?: string;
43
- /** Optional list of statistics to render below the content. @defaultValue defaultStatsData */
44
- aboutStats?: AboutStatData[];
45
-
46
- /** Optional top-level class to override the section root */
47
- className?: string;
48
-
49
- /** Slot-style overrides */
50
- section?: { className?: string };
51
- container?: { className?: string };
52
- inner?: { className?: string };
53
- contentContainer?: { className?: string };
54
- contentStack?: { className?: string };
55
- subheading?: { className?: string };
56
- heading?: { className?: string };
57
- content?: { className?: string };
58
- statsSection?: { className?: string };
59
- statsGrid?: { className?: string };
60
- statItem?: { className?: string };
61
- statNumber?: { className?: string };
62
- statLabel?: { className?: string };
63
-
64
- /** Controls text alignment at various breakpoints. @defaultValue "center" */
65
- aboutTextAlign?: "left" | "center" | "right";
66
- /** Whether to render the stats block at the bottom. @defaultValue true */
67
- showStats?: boolean;
68
- /** Enable count-up animation for numeric stats when they enter the viewport. @defaultValue false */
69
- animateStats?: boolean;
70
-
71
- /** ARIA label for the section. @defaultValue "About section" */
72
- ariaLabel?: string;
73
- }
74
-
75
- /**
76
- * Default statistics displayed if no aboutStats are provided.
77
- */
78
- const defaultStatsData: AboutStatData[] = [
79
- { value: "50", label: "Successful Projects", suffix: "+" },
80
- { value: "5", label: "Years Experience", suffix: "+" },
81
- { value: "100", label: "Happy Clients", suffix: "%" },
82
- { value: "24", label: "Support Hours", suffix: "/7" },
83
- ];
84
-
85
- /**
86
- * About section with a heading, optional subheading/content, and an optional
87
- * stats block.
88
- *
89
- * @remarks
90
- * - Styling: exposes slot-style className overrides. Consumer classes are
91
- * merged after defaults via cn().
92
- * - Layout: control text alignment with aboutTextAlign.
93
- * - Accessibility: rendered as a semantic <section> with aria-label.
94
- *
95
- * @example
96
- * <About
97
- * aboutHeadingText="Your Success Is Our Mission"
98
- * aboutContentText="We build digital products that convert."
99
- * aboutStats={[{ value: "50", label: "Successful Projects", suffix: "+" }]}
100
- * />
101
- */
102
- /**
103
- * About section with a heading, optional subheading/content, and an optional
104
- * stats block.
105
- *
106
- * @remarks
107
- * - Styling: exposes slot-style className overrides. Consumer classes are
108
- * merged after defaults via cn().
109
- * - Layout: control text alignment with aboutTextAlign.
110
- * - Accessibility: rendered as a semantic <section> with aria-label.
111
- *
112
- * @example
113
- * <About
114
- * aboutHeadingText="Your Success Is Our Mission"
115
- * aboutContentText="We build digital products that convert."
116
- * aboutStats={[{ value: "50", label: "Successful Projects", suffix: "+" }]}
117
- * />
118
- */
119
- /**
120
- * Animated count-up for integers using requestAnimationFrame.
121
- * Eases out and runs once when shouldStart becomes true.
122
- */
123
- function AnimatedCount({
124
- end,
125
- shouldStart,
126
- duration = 1500,
127
- }: {
128
- end: number;
129
- shouldStart: boolean;
130
- duration?: number;
131
- }) {
132
- const [value, setValue] = React.useState(0);
133
- const [done, setDone] = React.useState(false);
134
-
135
- const prefersReduced = React.useMemo(() => {
136
- if (typeof window === "undefined") return false;
137
- return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
138
- }, []);
139
-
140
- React.useEffect(() => {
141
- if (prefersReduced) return; // show end value immediately below
142
- if (!shouldStart || done) return;
143
- let raf: number;
144
- const startTs = performance.now();
145
-
146
- const tick = (now: number) => {
147
- const progress = Math.min((now - startTs) / duration, 1);
148
- const eased = 1 - Math.pow(1 - progress, 3);
149
- const next = Math.round(eased * end);
150
- setValue(next);
151
- if (progress < 1) {
152
- raf = requestAnimationFrame(tick);
153
- } else {
154
- setDone(true);
155
- }
156
- };
157
-
158
- raf = requestAnimationFrame(tick);
159
- return () => cancelAnimationFrame(raf);
160
- }, [shouldStart, end, duration, done, prefersReduced]);
161
-
162
- if (prefersReduced) return <>{end}</>;
163
- return <>{value}</>;
164
- }
165
-
166
- export function About({
167
- aboutHeadingText = "Your Success Is Our Mission",
168
- aboutSubheadingText,
169
- aboutContentText = "With 50+ successful projects and 5 years of experience, we specialize in creating digital solutions that drive real business growth.",
170
- aboutStats = defaultStatsData,
171
- className,
172
- section = { className: "py-20 bg-muted text-foreground" },
173
- container = { className: "max-w-7xl mx-auto px-6" },
174
- inner = { className: "flex flex-col gap-12" },
175
- contentContainer = { className: "max-w-4xl mx-auto" },
176
- contentStack = { className: "flex flex-col gap-6" },
177
- subheading = {
178
- className:
179
- "text-sm font-semibold font-poppins text-primary uppercase tracking-wider",
180
- },
181
- heading = {
182
- className: "text-3xl font-bold font-poppins text-foreground leading-tight",
183
- },
184
- content = {
185
- className:
186
- "text-lg font-inter text-foreground leading-relaxed opacity-90 max-w-3xl",
187
- },
188
- statsSection = {
189
- className:
190
- "bg-card p-8 rounded-xl shadow-lg mx-auto max-w-5xl w-full border border-border",
191
- },
192
- statsGrid = {
193
- className: "grid grid-cols-2 md:grid-cols-4 gap-8 justify-items-center",
194
- },
195
- statItem = { className: "flex flex-col items-center gap-2" },
196
- statNumber = {
197
- className: "text-4xl font-bold font-poppins text-foreground leading-none",
198
- },
199
- statLabel = {
200
- className:
201
- "text-sm font-medium font-inter text-foreground text-center opacity-80",
202
- },
203
- aboutTextAlign = "center",
204
- showStats = true,
205
- animateStats = false,
206
- ariaLabel = "About section",
207
- }: AboutProps) {
208
- const textAlignClasses = {
209
- left: "text-left",
210
- right: "text-right",
211
- center: "text-center",
212
- } as const;
213
-
214
- const statsSectionRef = React.useRef<HTMLDivElement | null>(null);
215
- const [shouldStartCount, setShouldStartCount] = React.useState(false);
216
-
217
- React.useEffect(() => {
218
- if (!animateStats) return;
219
- if (!statsSectionRef.current) return;
220
-
221
- const observer = new IntersectionObserver(
222
- (entries) => {
223
- for (const entry of entries) {
224
- if (entry.isIntersecting) {
225
- setShouldStartCount(true);
226
- observer.disconnect();
227
- break;
228
- }
229
- }
230
- },
231
- { threshold: 0.3 },
232
- );
233
-
234
- observer.observe(statsSectionRef.current);
235
-
236
- return () => observer.disconnect();
237
- }, [animateStats]);
238
-
239
- return (
240
- <section
241
- className={cn(section.className, className)}
242
- aria-label={ariaLabel}
243
- >
244
- <div className={cn(container.className)}>
245
- <div className={cn(inner.className)}>
246
- <div
247
- className={cn(
248
- contentContainer.className,
249
- textAlignClasses[aboutTextAlign],
250
- )}
251
- >
252
- <div className={cn(contentStack.className)}>
253
- {aboutSubheadingText && (
254
- <div className={cn(subheading.className)}>
255
- {aboutSubheadingText}
256
- </div>
257
- )}
258
- <h2 className={cn(heading.className)}>{aboutHeadingText}</h2>
259
- <p className={cn(content.className)}>{aboutContentText}</p>
260
- </div>
261
- </div>
262
- {showStats && aboutStats?.length ? (
263
- <div ref={statsSectionRef} className={cn(statsSection.className)}>
264
- <div className={cn(statsGrid.className)}>
265
- {aboutStats.map((s, i) => (
266
- <div
267
- key={`${s.label ?? "stat"}-${i}`}
268
- className={cn(statItem.className)}
269
- >
270
- <div className={cn(statNumber.className)}>
271
- {animateStats && Number.isFinite(Number(s.value)) ? (
272
- <AnimatedCount
273
- end={Number(s.value)}
274
- shouldStart={shouldStartCount}
275
- />
276
- ) : (
277
- s.value
278
- )}
279
- {s.suffix}
280
- </div>
281
- <div className={cn(statLabel.className)}>{s.label}</div>
282
- </div>
283
- ))}
284
- </div>
285
- </div>
286
- ) : null}
287
- </div>
288
- </div>
289
- </section>
290
- );
291
- }
1
+ "use client";
2
+
3
+ import React from "react";
4
+ import { cn } from "@/lib/utils";
5
+
6
+ /**
7
+ * Data used to render a single statistic in the About section.
8
+ *
9
+ * @remarks
10
+ * Typical examples include counts like projects completed or years of
11
+ * experience. The suffix lets you append symbols such as "+", "%", or "/7".
12
+ *
13
+ * @public
14
+ */
15
+ export interface AboutStatData {
16
+ /** The main numeric/text value (e.g., "50") */
17
+ value?: string;
18
+ /** Short label describing the stat (e.g., "Successful Projects") */
19
+ label?: string;
20
+ /** Optional suffix appended to the value (e.g., "+") */
21
+ suffix?: string;
22
+ }
23
+
24
+ /**
25
+ * Props for the About section component.
26
+ *
27
+ * @remarks
28
+ * - Styling: exposes slot-style className overrides (section, container,
29
+ * inner, contentContainer, contentStack, subheading, heading, content,
30
+ * statsSection, statsGrid, statItem, statNumber, statLabel). Consumer
31
+ * classes are merged after defaults via cn().
32
+ * - Layout: text alignment can be set via aboutTextAlign.
33
+ * - Motion: animateStats enables a count-up animation for numeric stats on first viewport visibility.
34
+ * - Accessibility: rendered as a semantic <section> with aria-label.
35
+ */
36
+ interface AboutProps {
37
+ /** Main heading text displayed in the section header. @defaultValue "Your Success Is Our Mission" */
38
+ aboutHeadingText?: string;
39
+ /** Optional subheading text displayed above the heading. */
40
+ aboutSubheadingText?: string;
41
+ /** Primary paragraph/content body. @defaultValue a short marketing blurb */
42
+ aboutContentText?: string;
43
+ /** Optional list of statistics to render below the content. @defaultValue defaultStatsData */
44
+ aboutStats?: AboutStatData[];
45
+
46
+ /** Optional top-level class to override the section root */
47
+ className?: string;
48
+
49
+ /** Slot-style overrides */
50
+ section?: { className?: string };
51
+ container?: { className?: string };
52
+ inner?: { className?: string };
53
+ contentContainer?: { className?: string };
54
+ contentStack?: { className?: string };
55
+ subheading?: { className?: string };
56
+ heading?: { className?: string };
57
+ content?: { className?: string };
58
+ statsSection?: { className?: string };
59
+ statsGrid?: { className?: string };
60
+ statItem?: { className?: string };
61
+ statNumber?: { className?: string };
62
+ statLabel?: { className?: string };
63
+
64
+ /** Controls text alignment at various breakpoints. @defaultValue "center" */
65
+ aboutTextAlign?: "left" | "center" | "right";
66
+ /** Whether to render the stats block at the bottom. @defaultValue true */
67
+ showStats?: boolean;
68
+ /** Enable count-up animation for numeric stats when they enter the viewport. @defaultValue false */
69
+ animateStats?: boolean;
70
+
71
+ /** ARIA label for the section. @defaultValue "About section" */
72
+ ariaLabel?: string;
73
+ }
74
+
75
+ /**
76
+ * Default statistics displayed if no aboutStats are provided.
77
+ */
78
+ const defaultStatsData: AboutStatData[] = [
79
+ { value: "50", label: "Successful Projects", suffix: "+" },
80
+ { value: "5", label: "Years Experience", suffix: "+" },
81
+ { value: "100", label: "Happy Clients", suffix: "%" },
82
+ { value: "24", label: "Support Hours", suffix: "/7" },
83
+ ];
84
+
85
+ /**
86
+ * About section with a heading, optional subheading/content, and an optional
87
+ * stats block.
88
+ *
89
+ * @remarks
90
+ * - Styling: exposes slot-style className overrides. Consumer classes are
91
+ * merged after defaults via cn().
92
+ * - Layout: control text alignment with aboutTextAlign.
93
+ * - Accessibility: rendered as a semantic <section> with aria-label.
94
+ *
95
+ * @example
96
+ * <About
97
+ * aboutHeadingText="Your Success Is Our Mission"
98
+ * aboutContentText="We build digital products that convert."
99
+ * aboutStats={[{ value: "50", label: "Successful Projects", suffix: "+" }]}
100
+ * />
101
+ */
102
+ /**
103
+ * About section with a heading, optional subheading/content, and an optional
104
+ * stats block.
105
+ *
106
+ * @remarks
107
+ * - Styling: exposes slot-style className overrides. Consumer classes are
108
+ * merged after defaults via cn().
109
+ * - Layout: control text alignment with aboutTextAlign.
110
+ * - Accessibility: rendered as a semantic <section> with aria-label.
111
+ *
112
+ * @example
113
+ * <About
114
+ * aboutHeadingText="Your Success Is Our Mission"
115
+ * aboutContentText="We build digital products that convert."
116
+ * aboutStats={[{ value: "50", label: "Successful Projects", suffix: "+" }]}
117
+ * />
118
+ */
119
+ /**
120
+ * Animated count-up for integers using requestAnimationFrame.
121
+ * Eases out and runs once when shouldStart becomes true.
122
+ */
123
+ function AnimatedCount({
124
+ end,
125
+ shouldStart,
126
+ duration = 1500,
127
+ }: {
128
+ end: number;
129
+ shouldStart: boolean;
130
+ duration?: number;
131
+ }) {
132
+ const [value, setValue] = React.useState(0);
133
+ const [done, setDone] = React.useState(false);
134
+
135
+ const prefersReduced = React.useMemo(() => {
136
+ if (typeof window === "undefined") return false;
137
+ return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
138
+ }, []);
139
+
140
+ React.useEffect(() => {
141
+ if (prefersReduced) return; // show end value immediately below
142
+ if (!shouldStart || done) return;
143
+ let raf: number;
144
+ const startTs = performance.now();
145
+
146
+ const tick = (now: number) => {
147
+ const progress = Math.min((now - startTs) / duration, 1);
148
+ const eased = 1 - Math.pow(1 - progress, 3);
149
+ const next = Math.round(eased * end);
150
+ setValue(next);
151
+ if (progress < 1) {
152
+ raf = requestAnimationFrame(tick);
153
+ } else {
154
+ setDone(true);
155
+ }
156
+ };
157
+
158
+ raf = requestAnimationFrame(tick);
159
+ return () => cancelAnimationFrame(raf);
160
+ }, [shouldStart, end, duration, done, prefersReduced]);
161
+
162
+ if (prefersReduced) return <>{end}</>;
163
+ return <>{value}</>;
164
+ }
165
+
166
+ export function About({
167
+ aboutHeadingText = "Your Success Is Our Mission",
168
+ aboutSubheadingText,
169
+ aboutContentText = "With 50+ successful projects and 5 years of experience, we specialize in creating digital solutions that drive real business growth.",
170
+ aboutStats = defaultStatsData,
171
+ className,
172
+ section = { className: "py-20 bg-muted text-foreground" },
173
+ container = { className: "max-w-7xl mx-auto px-6" },
174
+ inner = { className: "flex flex-col gap-12" },
175
+ contentContainer = { className: "max-w-4xl mx-auto" },
176
+ contentStack = { className: "flex flex-col gap-6" },
177
+ subheading = {
178
+ className:
179
+ "text-sm font-semibold font-poppins text-primary uppercase tracking-wider",
180
+ },
181
+ heading = {
182
+ className: "text-3xl font-bold font-poppins text-foreground leading-tight",
183
+ },
184
+ content = {
185
+ className:
186
+ "text-lg font-inter text-foreground leading-relaxed opacity-90 max-w-3xl",
187
+ },
188
+ statsSection = {
189
+ className:
190
+ "bg-card p-8 rounded-xl shadow-lg mx-auto max-w-5xl w-full border border-border",
191
+ },
192
+ statsGrid = {
193
+ className: "grid grid-cols-2 md:grid-cols-4 gap-8 justify-items-center",
194
+ },
195
+ statItem = { className: "flex flex-col items-center gap-2" },
196
+ statNumber = {
197
+ className: "text-4xl font-bold font-poppins text-foreground leading-none",
198
+ },
199
+ statLabel = {
200
+ className:
201
+ "text-sm font-medium font-inter text-foreground text-center opacity-80",
202
+ },
203
+ aboutTextAlign = "center",
204
+ showStats = true,
205
+ animateStats = false,
206
+ ariaLabel = "About section",
207
+ }: AboutProps) {
208
+ const textAlignClasses = {
209
+ left: "text-left",
210
+ right: "text-right",
211
+ center: "text-center",
212
+ } as const;
213
+
214
+ const statsSectionRef = React.useRef<HTMLDivElement | null>(null);
215
+ const [shouldStartCount, setShouldStartCount] = React.useState(false);
216
+
217
+ React.useEffect(() => {
218
+ if (!animateStats) return;
219
+ if (!statsSectionRef.current) return;
220
+
221
+ const observer = new IntersectionObserver(
222
+ (entries) => {
223
+ for (const entry of entries) {
224
+ if (entry.isIntersecting) {
225
+ setShouldStartCount(true);
226
+ observer.disconnect();
227
+ break;
228
+ }
229
+ }
230
+ },
231
+ { threshold: 0.3 },
232
+ );
233
+
234
+ observer.observe(statsSectionRef.current);
235
+
236
+ return () => observer.disconnect();
237
+ }, [animateStats]);
238
+
239
+ return (
240
+ <section
241
+ className={cn(section.className, className)}
242
+ aria-label={ariaLabel}
243
+ >
244
+ <div className={cn(container.className)}>
245
+ <div className={cn(inner.className)}>
246
+ <div
247
+ className={cn(
248
+ contentContainer.className,
249
+ textAlignClasses[aboutTextAlign],
250
+ )}
251
+ >
252
+ <div className={cn(contentStack.className)}>
253
+ {aboutSubheadingText && (
254
+ <div className={cn(subheading.className)}>
255
+ {aboutSubheadingText}
256
+ </div>
257
+ )}
258
+ <h2 className={cn(heading.className)}>{aboutHeadingText}</h2>
259
+ <p className={cn(content.className)}>{aboutContentText}</p>
260
+ </div>
261
+ </div>
262
+ {showStats && aboutStats?.length ? (
263
+ <div ref={statsSectionRef} className={cn(statsSection.className)}>
264
+ <div className={cn(statsGrid.className)}>
265
+ {aboutStats.map((s, i) => (
266
+ <div
267
+ key={`${s.label ?? "stat"}-${i}`}
268
+ className={cn(statItem.className)}
269
+ >
270
+ <div className={cn(statNumber.className)}>
271
+ {animateStats && Number.isFinite(Number(s.value)) ? (
272
+ <AnimatedCount
273
+ end={Number(s.value)}
274
+ shouldStart={shouldStartCount}
275
+ />
276
+ ) : (
277
+ s.value
278
+ )}
279
+ {s.suffix}
280
+ </div>
281
+ <div className={cn(statLabel.className)}>{s.label}</div>
282
+ </div>
283
+ ))}
284
+ </div>
285
+ </div>
286
+ ) : null}
287
+ </div>
288
+ </div>
289
+ </section>
290
+ );
291
+ }