| 1 | import { SlateElement, type SlateElementProps } from "platejs/static"; |
| 2 | |
| 3 | import { cn } from "@/lib/utils"; |
| 4 | import { type TArrowListElement } from "../../plugins/arrow-plugin"; |
| 5 | import { arrowItemVariants } from "../arrow-list"; |
| 6 | |
| 7 | export default function ArrowListStatic( |
| 8 | props: SlateElementProps<TArrowListElement>, |
| 9 | ) { |
| 10 | const { element } = props; |
| 11 | const { orientation, alignment = "center" } = element; |
| 12 | |
| 13 | return ( |
| 14 | <SlateElement {...props}> |
| 15 | {/* Container for alignment control */} |
| 16 | <div |
| 17 | className={cn( |
| 18 | "flex w-full", |
| 19 | // Apply alignment to the container, not the arrow list structure |
| 20 | alignment === "left" && "justify-start", |
| 21 | alignment === "right" && "justify-end", |
| 22 | alignment === "center" && "justify-center", |
| 23 | )} |
| 24 | > |
| 25 | {/* Arrow list structure - always full width */} |
| 26 | <div |
| 27 | className={cn( |
| 28 | arrowItemVariants({ |
| 29 | orientation: orientation, |
| 30 | }), |
| 31 | "w-full", // Ensure full width |
| 32 | )} |
| 33 | > |
| 34 | {props.children} |
| 35 | </div> |
| 36 | </div> |
| 37 | </SlateElement> |
| 38 | ); |
| 39 | } |
| 40 |