| 1 | "use client"; |
| 2 | |
| 3 | import { PlateElement, type PlateElementProps } from "platejs/react"; |
| 4 | |
| 5 | import { cn } from "@/lib/utils"; |
| 6 | import { |
| 7 | columnSizeVariant, |
| 8 | getDefaultColumnSize, |
| 9 | type PresentationColumnSize, |
| 10 | } from "../utils"; |
| 11 | |
| 12 | export default function BeforeAfterGroup(props: PlateElementProps) { |
| 13 | const { alignment = "center" } = props.element; |
| 14 | const columnSize = |
| 15 | (props.element.columnSize as PresentationColumnSize | undefined) ?? |
| 16 | getDefaultColumnSize(props.element.children?.length ?? 0); |
| 17 | |
| 18 | return ( |
| 19 | <PlateElement {...props} className="relative"> |
| 20 | <div |
| 21 | className={cn( |
| 22 | "relative mb-4 max-w-full items-stretch gap-6 *:min-w-0", |
| 23 | columnSizeVariant({ columnSize }), |
| 24 | alignment === "left" && "justify-start", |
| 25 | alignment === "right" && "justify-end", |
| 26 | alignment === "center" && "justify-center", |
| 27 | )} |
| 28 | > |
| 29 | {props.children} |
| 30 | </div> |
| 31 | </PlateElement> |
| 32 | ); |
| 33 | } |
| 34 |