11import { getIcon } from "@/components/IconRenderer"
22import { StaggerContainer , StaggerItem } from "@/components/animations/Stagger"
33import { Card } from "@/components/ui/Card"
4+ import { DotBackground } from "@/components/ui/DotBackground"
45import { Section } from "@/components/ui/Section"
56import type { FlowExampleLayoutBlock } from "@/lib/cms"
67import { cn } from "@/lib/utils"
7- import { FlowExampleDiagram , type FlowDiagramNode } from "./client/FlowExampleDiagram"
8+ import type { NodeAccent , NodeSegmentType } from "@/components/nodes/NodeDisplay"
9+ import { FlowExampleDiagram , type FlowDiagramItem , type FlowDiagramNode } from "./client/FlowExampleDiagram"
810
911interface FlowExampleSectionProps {
1012 content ?: FlowExampleLayoutBlock | null
@@ -19,27 +21,45 @@ export function FlowExampleSection({ content }: FlowExampleSectionProps) {
1921 icon : getIcon ( trigger . icon , 20 ) ,
2022 text : trigger . name ,
2123 }
22- const items : FlowDiagramNode [ ] =
24+ const items : FlowDiagramItem [ ] =
2325 content . flow ?. items ?. map ( ( item , index ) => ( {
2426 id : String ( item . id ?? index ) ,
25- icon : getIcon ( item . icon , 20 , item . id ?? index ) ,
26- text : item . text ,
27+ node : {
28+ color : item . color as NodeAccent ,
29+ outline : item . outline !== false ,
30+ segments : item . segments . map ( ( segment ) => ( {
31+ type : segment . type as NodeSegmentType ,
32+ value : segment . value ,
33+ } ) ) ,
34+ } ,
2735 } ) ) ?? [ ]
2836 const isCenter = content . sectionLayout === "flowCenter"
2937 const isRight = content . sectionLayout === "flowRight"
38+ const showBorder = Boolean ( content . showBorder )
3039 const flow = (
31- < div
32- className = { cn (
33- "relative m-2 min-w-0 overflow-hidden rounded-2xl border border-white/10 bg-primary/40" ,
34- isCenter ? "min-h-72" : "min-h-72 lg:min-h-96" ,
35- isRight && "lg:order-2"
36- ) }
37- >
40+ < div className = { cn ( "relative m-2 min-w-0 overflow-hidden rounded-2xl border border-white/10 bg-light" , isCenter ? "min-h-72" : "min-h-72 lg:min-h-96" , isRight && "lg:order-2" ) } >
41+ < DotBackground
42+ className = "opacity-50 mask-[radial-gradient(ellipse_at_center,black_35%,transparent_85%)]"
43+ dotColor = "rgba(255,255,255,0.14)"
44+ dotSize = { 1 }
45+ spacing = { 18 }
46+ / >
3847 < FlowExampleDiagram trigger = { triggerNode } items = { items } />
3948 </ div >
4049 )
4150 const body = (
42- < StaggerContainer className = { cn ( "flex flex-col justify-center p-8 md:p-10" , isRight && "lg:order-1" ) } delayChildren = { 0.06 } staggerChildren = { 0.08 } >
51+ < StaggerContainer
52+ className = { cn (
53+ "flex flex-col justify-center" ,
54+ showBorder && "p-8 md:p-10" ,
55+ ! showBorder && isCenter && "pt-8 md:pt-10" ,
56+ ! showBorder && ! isCenter && ! isRight && "py-8 pl-8 md:py-10 md:pl-10" ,
57+ ! showBorder && isRight && "py-8 pr-8 md:py-10 md:pr-10" ,
58+ isRight && "lg:order-1"
59+ ) }
60+ delayChildren = { 0.06 }
61+ staggerChildren = { 0.08 }
62+ >
4363 { content . contentHeading && (
4464 < StaggerItem as = "h2" y = { 14 } duration = { 0.38 } className = "text-3xl font-semibold leading-tight tracking-tight text-white md:text-4xl" >
4565 { content . contentHeading }
@@ -53,18 +73,32 @@ export function FlowExampleSection({ content }: FlowExampleSectionProps) {
5373 </ StaggerContainer >
5474 )
5575
56- const example = < article className = { cn ( "relative z-10 overflow-hidden" , isCenter ? "flex flex-col" : "grid lg:grid-cols-2" ) } > { isCenter ? < > { flow } { ( content . contentHeading || content . contentDescription ) && body } </ > : < > { flow } { body } </ > } </ article >
76+ const example = (
77+ < article className = { cn ( "relative z-10 overflow-hidden" , isCenter ? "flex flex-col" : "grid lg:grid-cols-2" ) } >
78+ { isCenter ? (
79+ < >
80+ { flow }
81+ { ( content . contentHeading || content . contentDescription ) && body }
82+ </ >
83+ ) : (
84+ < >
85+ { flow }
86+ { body }
87+ </ >
88+ ) }
89+ </ article >
90+ )
5791
5892 return (
59- < Section
60- heading = { content . sectionHeading }
61- description = { content . sectionDescription }
62- linkButton = { content . sectionLinkButton }
63- funnelType = "center"
64- animation = { { preset : "none" } }
65- >
93+ < Section heading = { content . sectionHeading } description = { content . sectionDescription } linkButton = { content . sectionLinkButton } funnelType = "center" animation = { { preset : "none" } } >
6694 < div className = { cn ( "mx-auto w-full" , isCenter && "max-w-5xl" ) } >
67- { content . showBorder ? < Card size = "lg" variant = "light" className = "p-2!" > { example } </ Card > : example }
95+ { showBorder ? (
96+ < Card size = "lg" variant = "light" className = "p-2!" >
97+ { example }
98+ </ Card >
99+ ) : (
100+ example
101+ ) }
68102 </ div >
69103 </ Section >
70104 )
0 commit comments