返回 presentation-ai
icon-list-static.tsx
根目录 / src / components / notebook / presentation / editor / custom-elements / static / icon-list-static.tsx
1 import { SlateElement, type SlateElementProps } from "platejs/static";
2
3 import { cn } from "@/lib/utils";
4 import {
5 getDefaultColumnSize,
6 getIconListOrientation,
7 iconListColumnSizeVariant,
8 } from "../../utils";
9
10 export function IconListStatic(props: SlateElementProps) {
11 const element = props.element as {
12 columnSize?: "sm" | "md" | "lg" | "xl";
13 alignment?: "left" | "center" | "right";
14 children?: unknown[];
15 orientation?: unknown;
16 };
17 const columnSize =
18 element.columnSize ?? getDefaultColumnSize(element.children?.length ?? 0);
19 const orientation = getIconListOrientation(
20 element.orientation,
21 element.children?.length ?? 0,
22 );
23
24 return (
25 <SlateElement {...props} className={cn("my-6", props.className)}>
26 <div className="@container/icon-list max-w-full">
27 <div
28 data-icon-list-grid="true"
29 className={cn(
30 iconListColumnSizeVariant({ columnSize }),
31 "gap-6",
32 orientation === "top" && "items-start",
33 )}
34 >
35 {props.children}
36 </div>
37 </div>
38 </SlateElement>
39 );
40 }
41
41 lines Plain Text