| 1 | "use client"; |
| 2 | |
| 3 | import { SlateElement, type SlateElementProps } from "platejs/static"; |
| 4 | |
| 5 | import { getSnakeGridColumn, getSnakeGridRow } from "../snake-shared"; |
| 6 | |
| 7 | export function SnakeItemStatic(props: SlateElementProps) { |
| 8 | const path = props.path ?? props.editor.api.findPath(props.element) ?? [0]; |
| 9 | const index = path.at(-1) ?? 0; |
| 10 | const isLowerLaneItem = index % 2 === 1; |
| 11 | |
| 12 | return ( |
| 13 | <SlateElement |
| 14 | {...props} |
| 15 | className="z-10 grid min-w-0 items-start justify-items-center" |
| 16 | style={{ |
| 17 | alignSelf: isLowerLaneItem ? "end" : "stretch", |
| 18 | gridRow: getSnakeGridRow(index), |
| 19 | gridColumn: getSnakeGridColumn(index), |
| 20 | justifySelf: "stretch", |
| 21 | }} |
| 22 | > |
| 23 | <div className="min-w-0 px-2 text-center text-(--presentation-muted-foreground) [&_h1]:text-xl [&_h2]:text-xl [&_h3]:text-xl [&_h4]:text-lg [&_h1]:text-(--presentation-muted-foreground) [&_h2]:text-(--presentation-muted-foreground) [&_h3]:text-(--presentation-muted-foreground) [&_p]:mt-1 [&_p]:text-sm"> |
| 24 | {props.children} |
| 25 | </div> |
| 26 | </SlateElement> |
| 27 | ); |
| 28 | } |
| 29 |