@ugurdemirel/landcraft 0.1.2 → 0.1.4

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 (116) hide show
  1. package/dist/index.cjs +2 -2
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.ts +41 -22
  4. package/dist/index.js +2261 -1937
  5. package/dist/index.js.map +1 -1
  6. package/dist/styles.css +3 -0
  7. package/package.json +1 -1
  8. package/src/components/Blog/BlogCard.tsx +12 -0
  9. package/src/components/Blog/BlogSection.tsx +95 -0
  10. package/src/components/Blog/index.ts +8 -0
  11. package/src/components/Blog/parts.tsx +38 -0
  12. package/src/components/Blog/types.ts +42 -0
  13. package/src/components/Blog/variants/Card.tsx +62 -0
  14. package/src/components/Blog/variants/Row.tsx +41 -0
  15. package/src/components/CTA/CTA.tsx +12 -0
  16. package/src/components/CTA/index.ts +2 -0
  17. package/src/components/CTA/parts.tsx +26 -0
  18. package/src/components/CTA/types.ts +12 -0
  19. package/src/components/CTA/variants/Inverse.tsx +50 -0
  20. package/src/components/CTA/variants/Panel.tsx +60 -0
  21. package/src/components/CTA/variants/Surface.tsx +34 -0
  22. package/src/components/FAQ/FAQ.tsx +48 -0
  23. package/src/components/FAQ/index.ts +2 -0
  24. package/src/components/FAQ/parts.tsx +74 -0
  25. package/src/components/FAQ/types.ts +18 -0
  26. package/src/components/FAQ/variants/Accordion.tsx +46 -0
  27. package/src/components/FAQ/variants/Cards.tsx +40 -0
  28. package/src/components/FAQ/variants/Split.tsx +44 -0
  29. package/src/components/Features/FeatureCard.tsx +44 -0
  30. package/src/components/Features/FeatureGrid.tsx +14 -0
  31. package/src/components/Features/index.ts +3 -0
  32. package/src/components/Features/parts.ts +15 -0
  33. package/src/components/Features/types.ts +25 -0
  34. package/src/components/Features/variants/Bento.tsx +32 -0
  35. package/src/components/Features/variants/Columns.tsx +21 -0
  36. package/src/components/Features/variants/EditorialRows.tsx +38 -0
  37. package/src/components/Footer/Footer.tsx +11 -0
  38. package/src/components/Footer/index.ts +2 -0
  39. package/src/components/Footer/parts.tsx +101 -0
  40. package/src/components/Footer/types.ts +32 -0
  41. package/src/components/Footer/variants/Classic.tsx +59 -0
  42. package/src/components/Footer/variants/Editorial.tsx +47 -0
  43. package/src/components/Footer/variants/Minimal.tsx +33 -0
  44. package/src/components/Hero/Hero.tsx +12 -0
  45. package/src/components/Hero/index.ts +2 -0
  46. package/src/components/Hero/parts.tsx +29 -0
  47. package/src/components/Hero/types.ts +20 -0
  48. package/src/components/Hero/variants/Centered.tsx +54 -0
  49. package/src/components/Hero/variants/Split.tsx +53 -0
  50. package/src/components/Hero/variants/Statement.tsx +60 -0
  51. package/src/components/LanguageSwitcher/LanguageSwitcher.tsx +37 -0
  52. package/src/components/LanguageSwitcher/index.ts +6 -0
  53. package/src/components/LanguageSwitcher/parts.tsx +144 -0
  54. package/src/components/LanguageSwitcher/types.ts +40 -0
  55. package/src/components/LanguageSwitcher/useLanguageSwitcher.ts +23 -0
  56. package/src/components/LanguageSwitcher/variants/Dropdown.tsx +88 -0
  57. package/src/components/LanguageSwitcher/variants/Modal.tsx +56 -0
  58. package/src/components/LogoCloud/LogoCloud.tsx +14 -0
  59. package/src/components/LogoCloud/index.ts +2 -0
  60. package/src/components/LogoCloud/parts.tsx +32 -0
  61. package/src/components/LogoCloud/types.ts +16 -0
  62. package/src/components/LogoCloud/variants/Marquee.tsx +30 -0
  63. package/src/components/LogoCloud/variants/Quiet.tsx +26 -0
  64. package/src/components/LogoCloud/variants/Strip.tsx +25 -0
  65. package/src/components/{MegaMenu.tsx → MegaMenu/MegaMenu.tsx} +108 -126
  66. package/src/components/MegaMenu/index.ts +9 -0
  67. package/src/components/MegaMenu/types.ts +56 -0
  68. package/src/components/Modal.tsx +1 -0
  69. package/src/components/Navbar/Navbar.tsx +185 -0
  70. package/src/components/Navbar/index.ts +2 -0
  71. package/src/components/Navbar/types.ts +30 -0
  72. package/src/components/Newsletter/Newsletter.tsx +12 -0
  73. package/src/components/Newsletter/index.ts +2 -0
  74. package/src/components/Newsletter/parts.tsx +23 -0
  75. package/src/components/Newsletter/types.ts +12 -0
  76. package/src/components/Newsletter/useNewsletterForm.ts +27 -0
  77. package/src/components/Newsletter/variants/Card.tsx +62 -0
  78. package/src/components/Newsletter/variants/Inline.tsx +54 -0
  79. package/src/components/Newsletter/variants/Underline.tsx +52 -0
  80. package/src/components/Pricing/Pricing.tsx +37 -0
  81. package/src/components/Pricing/index.ts +2 -0
  82. package/src/components/Pricing/parts.tsx +132 -0
  83. package/src/components/Pricing/types.ts +28 -0
  84. package/src/components/Pricing/variants/Bento.tsx +72 -0
  85. package/src/components/Pricing/variants/Cards.tsx +79 -0
  86. package/src/components/Pricing/variants/Compact.tsx +69 -0
  87. package/src/components/Stats/Stats.tsx +16 -0
  88. package/src/components/Stats/index.ts +2 -0
  89. package/src/components/Stats/parts.tsx +29 -0
  90. package/src/components/Stats/types.ts +23 -0
  91. package/src/components/Stats/variants/Cells.tsx +34 -0
  92. package/src/components/Stats/variants/Editorial.tsx +41 -0
  93. package/src/components/Stats/variants/Hairline.tsx +31 -0
  94. package/src/components/Stats/variants/Ticker.tsx +36 -0
  95. package/src/components/Testimonials/TestimonialCard.tsx +61 -0
  96. package/src/components/Testimonials/Testimonials.tsx +14 -0
  97. package/src/components/Testimonials/index.ts +3 -0
  98. package/src/components/Testimonials/parts.ts +7 -0
  99. package/src/components/Testimonials/types.ts +24 -0
  100. package/src/components/Testimonials/variants/Carousel.tsx +94 -0
  101. package/src/components/Testimonials/variants/Grid.tsx +19 -0
  102. package/src/components/Testimonials/variants/Marquee.tsx +28 -0
  103. package/src/utils/useTokenForeground.ts +1 -0
  104. package/src/components/Blog.tsx +0 -251
  105. package/src/components/CTA.tsx +0 -155
  106. package/src/components/FAQ.tsx +0 -163
  107. package/src/components/Features.tsx +0 -153
  108. package/src/components/Footer.tsx +0 -185
  109. package/src/components/Hero.tsx +0 -169
  110. package/src/components/LanguageSwitcher.tsx +0 -223
  111. package/src/components/LogoCloud.tsx +0 -100
  112. package/src/components/Navbar.tsx +0 -195
  113. package/src/components/Newsletter.tsx +0 -180
  114. package/src/components/Pricing.tsx +0 -336
  115. package/src/components/Stats.tsx +0 -181
  116. package/src/components/Testimonials.tsx +0 -205
@@ -0,0 +1,72 @@
1
+ import { cn } from "../../../utils/cn";
2
+ import { getContrastText } from "../../../utils/contrast";
3
+ import { PriceValue, PlanButton } from "../parts";
4
+ import { Check } from "../../../icons";
5
+ import type { PricingVariantProps } from "../types";
6
+
7
+ interface BentoProps extends PricingVariantProps {
8
+ className?: string;
9
+ }
10
+
11
+ export const PricingBento = ({ className, plans, billing, onSelect, ...props }: BentoProps) => {
12
+ return (
13
+ <div className={cn("w-full", className)} {...props}>
14
+ <div className="grid grid-cols-1 gap-4 lg:grid-cols-2">
15
+ {plans.map((plan) => {
16
+ const isHighlighted = plan.highlighted && !plan.customColor;
17
+ const bg = plan.customColor || (isHighlighted ? "rgb(var(--color-primary))" : undefined);
18
+ const fg = plan.customColor
19
+ ? getContrastText(plan.customColor, "#111111", "#ffffff")
20
+ : isHighlighted
21
+ ? "rgb(var(--color-on-primary))"
22
+ : undefined;
23
+ return (
24
+ <div
25
+ key={plan.name}
26
+ className={cn(
27
+ "flex h-full flex-col rounded-xl p-8",
28
+ bg
29
+ ? "lg:col-span-2"
30
+ : "border border-border bg-surface",
31
+ )}
32
+ style={bg ? { backgroundColor: bg, color: fg } : undefined}
33
+ >
34
+ <div className="flex flex-wrap items-start justify-between gap-4">
35
+ <div>
36
+ <h3 className={cn("font-display text-xl font-semibold tracking-tight", bg ? "text-current" : "text-foreground")}>
37
+ {plan.name}
38
+ </h3>
39
+ {plan.description ? (
40
+ <p className={cn("mt-1.5 text-sm", bg ? undefined : "text-muted-foreground")}>
41
+ {plan.description}
42
+ </p>
43
+ ) : null}
44
+ </div>
45
+ <div className={cn("font-display", bg ? "text-current" : "text-foreground")}>
46
+ <PriceValue value={billing === "monthly" ? plan.monthly : plan.yearly} billing={billing} dim={!bg} />
47
+ </div>
48
+ </div>
49
+ <ul
50
+ className={cn(
51
+ "mt-7 grid grid-cols-1 gap-x-8 gap-y-2.5 text-sm sm:grid-cols-2",
52
+ bg ? "lg:max-w-2xl" : undefined,
53
+ )}
54
+ >
55
+ {plan.features.map((feature) => (
56
+ <li key={feature} className={cn("flex items-start gap-2.5", bg ? "text-current" : "text-muted-foreground")}>
57
+ <Check className={cn("mt-0.5 h-4 w-4 shrink-0", bg ? "text-current" : "text-primary")} />
58
+ {feature}
59
+ </li>
60
+ ))}
61
+ </ul>
62
+ <div className="mt-8">
63
+ <PlanButton plan={plan} billing={billing} onSelect={onSelect} dark={!bg} />
64
+ </div>
65
+ </div>
66
+ );
67
+ })}
68
+ </div>
69
+ </div>
70
+ );
71
+ };
72
+ PricingBento.displayName = "PricingBento";
@@ -0,0 +1,79 @@
1
+ import { cn } from "../../../utils/cn";
2
+ import { getContrastText } from "../../../utils/contrast";
3
+ import { PriceValue, BillingToggle, PlanButton } from "../parts";
4
+ import { Check } from "../../../icons";
5
+ import type { PricingVariantProps } from "../types";
6
+
7
+ interface CardsProps extends PricingVariantProps {
8
+ className?: string;
9
+ onBillingChange: (billing: "monthly" | "yearly") => void;
10
+ }
11
+
12
+ export const PricingCards = ({ className, plans, billing, onSelect, onBillingChange, ...props }: CardsProps) => {
13
+ return (
14
+ <div className={cn("w-full", className)} {...props}>
15
+ <BillingToggle billing={billing} onChange={onBillingChange} />
16
+ <div className="grid grid-cols-1 gap-5 md:grid-cols-2 lg:grid-cols-3">
17
+ {plans.map((plan) => {
18
+ const isHighlighted = plan.highlighted && !plan.customColor;
19
+ const bg = plan.customColor || (isHighlighted ? "rgb(var(--color-primary))" : undefined);
20
+ const fg = plan.customColor
21
+ ? getContrastText(plan.customColor, "#111111", "#ffffff")
22
+ : isHighlighted
23
+ ? "rgb(var(--color-on-primary))"
24
+ : undefined;
25
+ return (
26
+ <div
27
+ key={plan.name}
28
+ className={cn(
29
+ "relative flex flex-col rounded-xl p-7",
30
+ bg ? "shadow-raised" : "border border-border bg-surface",
31
+ !bg && isHighlighted && "border-primary",
32
+ )}
33
+ style={bg ? { backgroundColor: bg, color: fg } : undefined}
34
+ >
35
+ {isHighlighted ? (
36
+ <span
37
+ className={cn(
38
+ "absolute -top-3 left-7 rounded-full px-2.5 py-1 text-[11px] font-semibold uppercase tracking-wider",
39
+ !bg && "bg-primary text-on-primary",
40
+ )}
41
+ style={
42
+ bg
43
+ ? { backgroundColor: "rgb(var(--color-on-primary))", color: "rgb(var(--color-primary))" }
44
+ : undefined
45
+ }
46
+ >
47
+ Most popular
48
+ </span>
49
+ ) : null}
50
+ <h3 className={cn("font-display text-lg font-semibold tracking-tight", bg ? "text-current" : "text-foreground")}>
51
+ {plan.name}
52
+ </h3>
53
+ {plan.description ? (
54
+ <p className={cn("mt-1.5 text-sm", bg ? undefined : "text-muted-foreground")}>
55
+ {plan.description}
56
+ </p>
57
+ ) : null}
58
+ <div className={cn("mt-6 flex items-baseline font-display", bg ? "text-current" : "text-foreground")}>
59
+ <PriceValue value={billing === "monthly" ? plan.monthly : plan.yearly} billing={billing} dim={!bg} />
60
+ </div>
61
+ <ul className={cn("mt-7 flex-1 space-y-2.5 text-sm", bg ? "text-current" : "text-muted-foreground")}>
62
+ {plan.features.map((feature) => (
63
+ <li key={feature} className="flex items-start gap-2.5">
64
+ <Check className={cn("mt-0.5 h-4 w-4 shrink-0", bg ? "text-current" : "text-primary")} />
65
+ {feature}
66
+ </li>
67
+ ))}
68
+ </ul>
69
+ <div className="mt-8">
70
+ <PlanButton plan={plan} billing={billing} onSelect={onSelect} dark={!bg} />
71
+ </div>
72
+ </div>
73
+ );
74
+ })}
75
+ </div>
76
+ </div>
77
+ );
78
+ };
79
+ PricingCards.displayName = "PricingCards";
@@ -0,0 +1,69 @@
1
+ import { cn } from "../../../utils/cn";
2
+ import { PlanButton } from "../parts";
3
+ import { Check } from "../../../icons";
4
+ import type { PricingVariantProps } from "../types";
5
+
6
+ interface CompactProps extends PricingVariantProps {
7
+ className?: string;
8
+ }
9
+
10
+ export const PricingCompact = ({ className, plans, billing, onSelect, ...props }: CompactProps) => {
11
+ const price = (v: number | null) => (v === null ? "Custom" : `$${v}`);
12
+
13
+ return (
14
+ <div className={cn("w-full", className)} {...props}>
15
+ <div className="divide-y divide-border overflow-hidden rounded-xl border border-border bg-surface">
16
+ {plans.map((plan) => {
17
+ const value = billing === "monthly" ? plan.monthly : plan.yearly;
18
+ const isHighlighted = plan.highlighted && !plan.customColor;
19
+ const bg = plan.customColor ? "rgb(var(--color-surface))" : isHighlighted ? "rgb(var(--color-primary-soft))" : undefined;
20
+ const fg = plan.customColor ? plan.customColor : isHighlighted ? "rgb(var(--color-primary))" : undefined;
21
+ return (
22
+ <div
23
+ key={plan.name}
24
+ className={cn(
25
+ "group flex flex-col gap-5 p-5 transition-colors duration-200 hover:bg-surface-strong sm:flex-row sm:items-center sm:justify-between",
26
+ isHighlighted && "bg-primary-soft/60",
27
+ )}
28
+ style={bg ? { backgroundColor: bg } : undefined}
29
+ >
30
+ <div className="min-w-0">
31
+ <div className="flex items-center gap-2.5">
32
+ <h3 className="font-display text-lg font-semibold tracking-tight text-foreground">
33
+ {plan.name}
34
+ </h3>
35
+ {isHighlighted ? (
36
+ <span className="rounded-full bg-primary px-2.5 py-0.5 text-[11px] font-semibold text-on-primary uppercase tracking-wider">
37
+ Popular
38
+ </span>
39
+ ) : null}
40
+ </div>
41
+ {plan.description ? (
42
+ <p className="mt-1 truncate text-sm text-muted-foreground">{plan.description}</p>
43
+ ) : null}
44
+ </div>
45
+ <div className="flex items-center gap-6">
46
+ <ul className="hidden items-center gap-4 lg:flex">
47
+ {plan.features.slice(0, 3).map((f) => (
48
+ <li key={f} className="flex items-center gap-1.5 text-sm text-muted-foreground" style={{ color: fg }}>
49
+ <Check className="h-3.5 w-3.5 text-current" />
50
+ {f}
51
+ </li>
52
+ ))}
53
+ </ul>
54
+ <div className="font-display text-2xl font-semibold tracking-tight text-foreground">
55
+ {price(value)}
56
+ {value !== null ? (
57
+ <span className="text-sm font-normal text-muted-foreground">/{billing === "monthly" ? "mo" : "yr"}</span>
58
+ ) : null}
59
+ </div>
60
+ <PlanButton plan={plan} billing={billing} onSelect={onSelect} />
61
+ </div>
62
+ </div>
63
+ );
64
+ })}
65
+ </div>
66
+ </div>
67
+ );
68
+ };
69
+ PricingCompact.displayName = "PricingCompact";
@@ -0,0 +1,16 @@
1
+ import { forwardRef } from "react";
2
+ import type { StatsProps } from "./types";
3
+ import { StatsEditorial } from "./variants/Editorial";
4
+ import { StatsHairline } from "./variants/Hairline";
5
+ import { StatsCells } from "./variants/Cells";
6
+ import { StatsTicker } from "./variants/Ticker";
7
+
8
+ export const Stats = forwardRef<HTMLDListElement, StatsProps>(
9
+ ({ option = "editorial", ...props }, ref) => {
10
+ if (option === "ticker") return <StatsTicker ref={ref} {...props} />;
11
+ if (option === "cells") return <StatsCells ref={ref} {...props} />;
12
+ if (option === "hairline") return <StatsHairline ref={ref} {...props} />;
13
+ return <StatsEditorial ref={ref} {...props} />;
14
+ },
15
+ );
16
+ Stats.displayName = "Stats";
@@ -0,0 +1,2 @@
1
+ export { Stats } from "./Stats";
2
+ export type { StatsProps, StatsOption, Stat } from "./types";
@@ -0,0 +1,29 @@
1
+ import { cn } from "../../utils/cn";
2
+ import { ArrowUp, ArrowDown } from "../../icons";
3
+
4
+ export const valueBase =
5
+ "font-display font-semibold tabular-nums tracking-[-0.02em] text-foreground";
6
+
7
+ export const suffixBase = "ml-1 font-sans text-sm font-normal tracking-normal text-muted-foreground";
8
+
9
+ export const gridCols: Record<2 | 3 | 4, string> = {
10
+ 2: "sm:grid-cols-2",
11
+ 3: "sm:grid-cols-2 lg:grid-cols-3",
12
+ 4: "sm:grid-cols-2 lg:grid-cols-4",
13
+ };
14
+
15
+ export function DeltaBadge({ delta }: { delta: number }) {
16
+ const isUp = delta >= 0;
17
+ const Icon = isUp ? ArrowUp : ArrowDown;
18
+ return (
19
+ <span
20
+ className={cn(
21
+ "inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-semibold tabular-nums",
22
+ isUp ? "bg-accent/10 text-accent" : "bg-danger-soft text-danger",
23
+ )}
24
+ >
25
+ <Icon className="h-3 w-3" />
26
+ {Math.abs(delta)}%
27
+ </span>
28
+ );
29
+ }
@@ -0,0 +1,23 @@
1
+ import type { HTMLAttributes, ReactNode } from "react";
2
+
3
+ export type StatsOption = "editorial" | "hairline" | "cells" | "ticker";
4
+
5
+ export interface Stat {
6
+ value: string;
7
+ label: string;
8
+ /** Small unit rendered inline with the value, e.g. "ms" or "₺". */
9
+ suffix?: string;
10
+ /** Trend change in percent — renders an up/down badge. */
11
+ delta?: number;
12
+ /** Optional supporting copy. */
13
+ sub?: string;
14
+ icon?: ReactNode;
15
+ /** Highlights the value with the primary token. */
16
+ accent?: boolean;
17
+ }
18
+
19
+ export interface StatsProps extends HTMLAttributes<HTMLDListElement> {
20
+ stats: Stat[];
21
+ option?: StatsOption;
22
+ columns?: 2 | 3 | 4;
23
+ }
@@ -0,0 +1,34 @@
1
+ import { forwardRef, type HTMLAttributes } from "react";
2
+ import { cn } from "../../../utils/cn";
3
+ import { valueBase, suffixBase, gridCols } from "../parts";
4
+ import type { Stat } from "../types";
5
+
6
+ interface CellsProps extends HTMLAttributes<HTMLDListElement> {
7
+ stats: Stat[];
8
+ columns?: 2 | 3 | 4;
9
+ }
10
+
11
+ export const StatsCells = forwardRef<HTMLDListElement, CellsProps>(
12
+ ({ className, stats, columns = 4, ...props }, ref) => (
13
+ <dl ref={ref} className={cn("grid grid-cols-1 gap-4", gridCols[columns], className)} {...props}>
14
+ {stats.map((stat) => (
15
+ <div
16
+ key={stat.label}
17
+ className="flex min-h-[8.5rem] flex-col justify-between rounded-xl border border-border bg-surface p-6"
18
+ >
19
+ <dd className={cn(valueBase, "text-3xl", stat.accent ? "text-primary" : undefined)}>
20
+ {stat.value}
21
+ {stat.suffix ? <span className={suffixBase}>{stat.suffix}</span> : null}
22
+ </dd>
23
+ <div className="mt-5 flex items-center justify-between gap-3">
24
+ <dt className="text-sm text-muted-foreground">{stat.label}</dt>
25
+ {stat.icon ? (
26
+ <span className="text-foreground/30">{stat.icon}</span>
27
+ ) : null}
28
+ </div>
29
+ </div>
30
+ ))}
31
+ </dl>
32
+ ),
33
+ );
34
+ StatsCells.displayName = "StatsCells";
@@ -0,0 +1,41 @@
1
+ import { forwardRef, type HTMLAttributes } from "react";
2
+ import { cn } from "../../../utils/cn";
3
+ import { valueBase, suffixBase, gridCols, DeltaBadge } from "../parts";
4
+ import type { Stat } from "../types";
5
+
6
+ interface EditorialProps extends HTMLAttributes<HTMLDListElement> {
7
+ stats: Stat[];
8
+ columns?: 2 | 3 | 4;
9
+ }
10
+
11
+ /** editorial — label above, oversized number, hairline rule under. */
12
+ export const StatsEditorial = forwardRef<HTMLDListElement, EditorialProps>(
13
+ ({ className, stats, columns = 4, ...props }, ref) => (
14
+ <dl ref={ref} className={cn("grid grid-cols-1 gap-x-10 gap-y-12", gridCols[columns], className)} {...props}>
15
+ {stats.map((stat) => (
16
+ <div key={stat.label} className="border-t border-border pt-6">
17
+ <div className="flex items-center justify-between gap-3">
18
+ <dt className="text-xs font-semibold uppercase tracking-[0.18em] text-muted-foreground">
19
+ {stat.label}
20
+ </dt>
21
+ {typeof stat.delta === "number" ? <DeltaBadge delta={stat.delta} /> : null}
22
+ </div>
23
+ <dd
24
+ className={cn(
25
+ valueBase,
26
+ "mt-4 text-5xl sm:text-6xl",
27
+ stat.accent ? "text-primary" : undefined,
28
+ )}
29
+ >
30
+ {stat.value}
31
+ {stat.suffix ? <span className={suffixBase}>{stat.suffix}</span> : null}
32
+ </dd>
33
+ {stat.sub ? (
34
+ <p className="mt-3 max-w-xs text-[13px] leading-5 text-muted-foreground">{stat.sub}</p>
35
+ ) : null}
36
+ </div>
37
+ ))}
38
+ </dl>
39
+ ),
40
+ );
41
+ StatsEditorial.displayName = "StatsEditorial";
@@ -0,0 +1,31 @@
1
+ import { forwardRef, type HTMLAttributes } from "react";
2
+ import { cn } from "../../../utils/cn";
3
+ import { valueBase, suffixBase, gridCols } from "../parts";
4
+ import type { Stat } from "../types";
5
+
6
+ interface HairlineProps extends HTMLAttributes<HTMLDListElement> {
7
+ stats: Stat[];
8
+ columns?: 2 | 3 | 4;
9
+ }
10
+
11
+ export const StatsHairline = forwardRef<HTMLDListElement, HairlineProps>(
12
+ ({ className, stats, columns = 4, ...props }, ref) => (
13
+ <dl ref={ref} className={cn("grid grid-cols-1 gap-y-10", gridCols[columns], className)} {...props}>
14
+ {stats.map((stat, i) => (
15
+ <div
16
+ key={stat.label}
17
+ className={cn("text-center", columns > 1 && i > 0 && "sm:border-l sm:border-border")}
18
+ >
19
+ <dd className={cn(valueBase, "text-5xl", stat.accent ? "text-primary" : undefined)}>
20
+ {stat.value}
21
+ {stat.suffix ? <span className={suffixBase}>{stat.suffix}</span> : null}
22
+ </dd>
23
+ <dt className="mt-3 text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground">
24
+ {stat.label}
25
+ </dt>
26
+ </div>
27
+ ))}
28
+ </dl>
29
+ ),
30
+ );
31
+ StatsHairline.displayName = "StatsHairline";
@@ -0,0 +1,36 @@
1
+ import { forwardRef, type HTMLAttributes } from "react";
2
+ import { cn } from "../../../utils/cn";
3
+ import { valueBase, suffixBase, DeltaBadge } from "../parts";
4
+ import type { Stat } from "../types";
5
+
6
+ interface TickerProps extends HTMLAttributes<HTMLDListElement> {
7
+ stats: Stat[];
8
+ }
9
+
10
+ export const StatsTicker = forwardRef<HTMLDListElement, TickerProps>(
11
+ ({ className, stats, ...props }, ref) => (
12
+ <dl ref={ref} className={cn("flex w-full items-stretch overflow-x-auto rounded-2xl border border-border bg-surface", className)} {...props}>
13
+ {stats.map((stat, i) => (
14
+ <div
15
+ key={stat.label}
16
+ className={cn("flex min-w-[11rem] flex-1 flex-col gap-3 p-6", i > 0 && "border-l border-border")}
17
+ >
18
+ <div className="flex items-center justify-between gap-3">
19
+ <dt className="text-xs font-semibold uppercase tracking-[0.14em] text-muted-foreground">
20
+ {stat.label}
21
+ </dt>
22
+ {typeof stat.delta === "number" ? <DeltaBadge delta={stat.delta} /> : null}
23
+ </div>
24
+ <dd className={cn(valueBase, "text-3xl", stat.accent ? "text-primary" : undefined)}>
25
+ {stat.value}
26
+ {stat.suffix ? <span className={suffixBase}>{stat.suffix}</span> : null}
27
+ </dd>
28
+ {stat.sub ? (
29
+ <p className="text-[13px] leading-5 text-muted-foreground">{stat.sub}</p>
30
+ ) : null}
31
+ </div>
32
+ ))}
33
+ </dl>
34
+ ),
35
+ );
36
+ StatsTicker.displayName = "StatsTicker";
@@ -0,0 +1,61 @@
1
+ import { forwardRef } from "react";
2
+ import { cn } from "../../utils/cn";
3
+ import { getContrastText } from "../../utils/contrast";
4
+ import { Quote, Star } from "../../icons";
5
+ import { initials } from "./parts";
6
+ import type { TestimonialCardProps } from "./types";
7
+
8
+ export const TestimonialCard = forwardRef<HTMLElement, TestimonialCardProps>(
9
+ function TestimonialCard({ className, testimonial, ...props }, ref) {
10
+ const { quote, author, role, company, avatar, accent, rating } = testimonial;
11
+ const badgeStyle = accent
12
+ ? { backgroundColor: accent, color: getContrastText(accent, "#111111", "#ffffff") }
13
+ : undefined;
14
+
15
+ return (
16
+ <figure
17
+ ref={ref}
18
+ className={cn(
19
+ "mb-4 flex flex-col break-inside-avoid rounded-2xl border border-border bg-surface p-7",
20
+ className,
21
+ )}
22
+ {...props}
23
+ >
24
+ <div className="mb-5 flex items-center justify-between">
25
+ <Quote className={cn("h-6 w-6", accent ? undefined : "text-primary/30")} style={accent ? { color: accent } : undefined} />
26
+ {rating ? (
27
+ <span className="flex items-center gap-0.5 text-amber-500" aria-label={`${rating} / 5`}>
28
+ {Array.from({ length: 5 }).map((_, i) => (
29
+ <Star key={i} className="h-3.5 w-3.5" />
30
+ ))}
31
+ </span>
32
+ ) : null}
33
+ </div>
34
+ <blockquote className="flex-1 text-[15px] leading-7 text-foreground/85">{quote}</blockquote>
35
+ <figcaption className="mt-6 flex items-center gap-3">
36
+ {avatar ? (
37
+ avatar
38
+ ) : (
39
+ <span
40
+ style={badgeStyle}
41
+ className={cn(
42
+ "inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full text-xs font-bold",
43
+ !accent && "bg-primary-soft text-primary",
44
+ )}
45
+ >
46
+ {initials(author)}
47
+ </span>
48
+ )}
49
+ <div>
50
+ <div className="text-sm font-semibold text-foreground">{author}</div>
51
+ {(role || company) && (
52
+ <div className="text-xs text-muted-foreground">
53
+ {[role, company].filter(Boolean).join(" · ")}
54
+ </div>
55
+ )}
56
+ </div>
57
+ </figcaption>
58
+ </figure>
59
+ );
60
+ },
61
+ );
@@ -0,0 +1,14 @@
1
+ import { forwardRef } from "react";
2
+ import type { TestimonialsProps } from "./types";
3
+ import { TestimonialsGrid } from "./variants/Grid";
4
+ import { TestimonialsMarquee } from "./variants/Marquee";
5
+ import { TestimonialsCarousel } from "./variants/Carousel";
6
+
7
+ export const Testimonials = forwardRef<HTMLDivElement, TestimonialsProps>(
8
+ ({ option = "grid", ...props }, ref) => {
9
+ if (option === "carousel") return <TestimonialsCarousel ref={ref} {...props} />;
10
+ if (option === "marquee") return <TestimonialsMarquee ref={ref} {...props} />;
11
+ return <TestimonialsGrid ref={ref} {...props} />;
12
+ },
13
+ );
14
+ Testimonials.displayName = "Testimonials";
@@ -0,0 +1,3 @@
1
+ export { Testimonials } from "./Testimonials";
2
+ export { TestimonialCard } from "./TestimonialCard";
3
+ export type { TestimonialsProps, TestimonialCardProps, TestimonialsOption, Testimonial } from "./types";
@@ -0,0 +1,7 @@
1
+ export const initials = (name: string) =>
2
+ name
3
+ .split(" ")
4
+ .map((p) => p[0])
5
+ .join("")
6
+ .slice(0, 2)
7
+ .toUpperCase();
@@ -0,0 +1,24 @@
1
+ import type { HTMLAttributes, ReactNode } from "react";
2
+
3
+ export type TestimonialsOption = "grid" | "carousel" | "marquee";
4
+
5
+ export interface Testimonial {
6
+ quote: string;
7
+ author: string;
8
+ role?: string;
9
+ company?: string;
10
+ avatar?: ReactNode;
11
+ /** Arbitrary CSS color for the initials avatar. */
12
+ accent?: string;
13
+ rating?: number;
14
+ }
15
+
16
+ export interface TestimonialCardProps extends HTMLAttributes<HTMLElement> {
17
+ testimonial: Testimonial;
18
+ }
19
+
20
+ export interface TestimonialsProps extends HTMLAttributes<HTMLDivElement> {
21
+ items: Testimonial[];
22
+ option?: TestimonialsOption;
23
+ title?: string;
24
+ }
@@ -0,0 +1,94 @@
1
+ "use client";
2
+ import { forwardRef, useState, type HTMLAttributes } from "react";
3
+ import { cn } from "../../../utils/cn";
4
+ import { getContrastText } from "../../../utils/contrast";
5
+ import { ChevronLeft, ChevronRight, Quote } from "../../../icons";
6
+ import { initials } from "../parts";
7
+ import type { Testimonial } from "../types";
8
+
9
+ interface CarouselProps extends HTMLAttributes<HTMLDivElement> {
10
+ items: Testimonial[];
11
+ }
12
+
13
+ export const TestimonialsCarousel = forwardRef<HTMLDivElement, CarouselProps>(
14
+ ({ className, items, ...props }, ref) => {
15
+ const [index, setIndex] = useState(0);
16
+ const item = items[index % items.length];
17
+ const badgeStyle = item.accent
18
+ ? { backgroundColor: item.accent, color: getContrastText(item.accent, "#111111", "#ffffff") }
19
+ : undefined;
20
+
21
+ const go = (dir: 1 | -1) => setIndex((i) => (i + dir + items.length) % items.length);
22
+
23
+ return (
24
+ <div className={cn("mx-auto w-full max-w-3xl", className)} ref={ref} {...props}>
25
+ <figure className="relative rounded-2xl border border-border bg-surface p-10 text-center sm:p-14">
26
+ <Quote
27
+ className={cn("mx-auto mb-6 h-8 w-8", item.accent ? undefined : "text-primary/25")}
28
+ style={item.accent ? { color: item.accent } : undefined}
29
+ aria-hidden
30
+ />
31
+ <blockquote className="font-display text-balance text-xl font-medium leading-relaxed tracking-tight text-foreground sm:text-2xl">
32
+ {item.quote}
33
+ </blockquote>
34
+ <figcaption className="mt-8 flex items-center justify-center gap-3">
35
+ {item.avatar ? (
36
+ item.avatar
37
+ ) : (
38
+ <span
39
+ style={badgeStyle}
40
+ className={cn(
41
+ "inline-flex h-11 w-11 items-center justify-center rounded-full text-xs font-bold",
42
+ !item.accent && "bg-foreground text-background",
43
+ )}
44
+ >
45
+ {initials(item.author)}
46
+ </span>
47
+ )}
48
+ <div className="text-left">
49
+ <div className="text-sm font-semibold text-foreground">{item.author}</div>
50
+ <div className="text-xs text-muted-foreground">
51
+ {[item.role, item.company].filter(Boolean).join(" · ")}
52
+ </div>
53
+ </div>
54
+ </figcaption>
55
+ </figure>
56
+
57
+ <div className="mt-6 flex items-center justify-center gap-4">
58
+ <button
59
+ type="button"
60
+ aria-label="Previous testimonial"
61
+ onClick={() => go(-1)}
62
+ className="inline-flex h-10 w-10 cursor-pointer items-center justify-center rounded-full border border-border bg-surface text-foreground transition-colors duration-150 hover:border-foreground/25 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
63
+ >
64
+ <ChevronLeft className="h-4 w-4" />
65
+ </button>
66
+ <div className="flex items-center gap-1.5">
67
+ {items.map((_, i) => (
68
+ <button
69
+ key={i}
70
+ type="button"
71
+ aria-label={`Testimonial ${i + 1}`}
72
+ aria-current={i === index}
73
+ onClick={() => setIndex(i)}
74
+ className={cn(
75
+ "h-1.5 cursor-pointer rounded-full transition-all duration-200",
76
+ i === index ? "w-6 bg-foreground" : "w-1.5 bg-foreground/25 hover:bg-foreground/50",
77
+ )}
78
+ />
79
+ ))}
80
+ </div>
81
+ <button
82
+ type="button"
83
+ aria-label="Next testimonial"
84
+ onClick={() => go(1)}
85
+ className="inline-flex h-10 w-10 cursor-pointer items-center justify-center rounded-full border border-border bg-surface text-foreground transition-colors duration-150 hover:border-foreground/25 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
86
+ >
87
+ <ChevronRight className="h-4 w-4" />
88
+ </button>
89
+ </div>
90
+ </div>
91
+ );
92
+ },
93
+ );
94
+ TestimonialsCarousel.displayName = "TestimonialsCarousel";