返回 presentation-ai
staircase.tsx
1 "use client";
2
3 import { PlateElement, type PlateElementProps } from "platejs/react";
4
5 import { cn } from "@/lib/utils";
6 import { type TStairGroupElement } from "../plugins/staircase-plugin";
7
8 export default function Staircase(
9 props: PlateElementProps<TStairGroupElement>,
10 ) {
11 const { alignment = "center" } = props.element;
12
13 return (
14 <PlateElement {...props} className="relative">
15 {/* Container for alignment control */}
16 <div
17 className={cn(
18 "my-0 flex w-full",
19 // Apply alignment to the container, not the staircase structure
20 alignment === "left" && "justify-start",
21 alignment === "right" && "justify-end",
22 alignment === "center" && "justify-center",
23 )}
24 >
25 {/* Staircase structure - always full width, vertical flow */}
26 <div className="flex w-full flex-col gap-2">{props.children}</div>
27 </div>
28 </PlateElement>
29 );
30 }
31
31 lines Plain Text