(props: unknown)
| 10 | export { BlocksToContext, WithTooltip } from "@/components/blocks-to-context" |
| 11 | |
| 12 | export function Chain(props: unknown) { |
| 13 | const { intro, steps, outro } = parseProps( |
| 14 | props, |
| 15 | Block.extend({ |
| 16 | intro: Block.optional(), |
| 17 | steps: z.array( |
| 18 | Block.extend({ |
| 19 | code: CodeBlock, |
| 20 | this: Block.optional(), |
| 21 | next: Block.optional(), |
| 22 | }), |
| 23 | ), |
| 24 | outro: Block.optional(), |
| 25 | }), |
| 26 | ) |
| 27 | return ( |
| 28 | <section className="md:grid grid-cols-2 grid-flow-col gap-2 md:-mx-10 lg:-mx-32 mt-2"> |
| 29 | <div className="col-start-2 flex"> |
| 30 | {intro && ( |
| 31 | <> |
| 32 | <Arrow intro /> |
| 33 | <div className=" self-center flex-1 min-w-0">{intro?.children}</div> |
| 34 | </> |
| 35 | )} |
| 36 | </div> |
| 37 | {steps.map((step, i) => ( |
| 38 | <Fragment key={i}> |
| 39 | <div className="col-start-1 row-span-3 "> |
| 40 | <Code codeblock={step.code} className="h-full m-0" /> |
| 41 | </div> |
| 42 | |
| 43 | <div className="col-start-2 flex"> |
| 44 | {step.this && ( |
| 45 | <> |
| 46 | <Arrow /> |
| 47 | <div className=" self-center flex-1 min-w-0"> |
| 48 | {step.this.children} |
| 49 | </div> |
| 50 | </> |
| 51 | )} |
| 52 | </div> |
| 53 | {i < steps.length - 1 && ( |
| 54 | <div className="col-start-2 row-span-2 flex"> |
| 55 | <Arrow /> |
| 56 | <div className=" self-center flex-1 min-w-0"> |
| 57 | {step.next?.children} |
| 58 | </div> |
| 59 | </div> |
| 60 | )} |
| 61 | </Fragment> |
| 62 | ))} |
| 63 | <div className="col-start-2">{outro?.children}</div> |
| 64 | </section> |
| 65 | ) |
| 66 | } |
| 67 | |
| 68 | function Arrow({ intro }: { intro?: boolean }) { |
| 69 | return ( |
nothing calls this directly
no test coverage detected
searching dependent graphs…