返回 presentation-ai
bullet-static.tsx
1 import { SlateElement, type SlateElementProps } from "platejs/static";
2
3 import { cn } from "@/lib/utils";
4 import { columnSizeVariant, getDefaultColumnSize } from "../../utils";
5
6 export function BulletsElementStatic(props: SlateElementProps) {
7 const element = props.element as {
8 columnSize?: "sm" | "md" | "lg" | "xl";
9 bulletType?: "numbered" | "basic" | "arrow";
10 alignment?: "left" | "center" | "right";
11 children?: unknown[];
12 };
13 const alignment = element.alignment ?? "center";
14 const columnSize =
15 element.columnSize ?? getDefaultColumnSize(element.children?.length ?? 0);
16
17 return (
18 <SlateElement {...props} className={cn("my-0", props.className)}>
19 <div
20 className={cn(
21 "max-w-full",
22 columnSizeVariant({ columnSize }),
23 "gap-6",
24 // Only apply horizontal alignment, don't break the grid layout
25 alignment === "left" && "justify-start",
26 alignment === "right" && "justify-end",
27 alignment === "center" && "justify-center",
28 )}
29 >
30 {props.children}
31 </div>
32 </SlateElement>
33 );
34 }
35
35 lines Plain Text