返回 presentation-ai
pyramid-static.tsx
1 import { SlateElement, type SlateElementProps } from "platejs/static";
2
3 import { cn } from "@/lib/utils";
4 import { PyramidHeightProvider } from "../pyramid-height-context";
5
6 export default function PyramidStatic(props: SlateElementProps) {
7 const { alignment = "center" } = props.element as {
8 alignment?: "left" | "center" | "right";
9 };
10
11 return (
12 <SlateElement {...props}>
13 {/* Container for alignment control */}
14 <div
15 className={cn(
16 "my-4 mb-8 flex w-full",
17 // Apply alignment to the container, not the grid
18 alignment === "left" && "justify-start",
19 alignment === "right" && "justify-end",
20 alignment === "center" && "justify-center",
21 )}
22 >
23 {/* Pyramid grid - always full width */}
24 <PyramidHeightProvider>
25 <div className="grid w-full grid-flow-row auto-rows-fr overflow-visible">
26 {props.children}
27 </div>
28 </PyramidHeightProvider>
29 </div>
30 </SlateElement>
31 );
32 }
33
33 lines Plain Text