返回 presentation-ai
diagram-static-utils.ts
根目录 / src / components / notebook / presentation / editor / custom-elements / static / diagram-static-utils.ts
1 "use client";
2
3 export type StaticDiagramElement = {
4 alignment?: "left" | "center" | "right";
5 centerText?: string;
6 children?: unknown[];
7 icon?: string;
8 id?: string | number;
9 };
10
11 export function getStaticDiagramJustifyClass(
12 alignment: StaticDiagramElement["alignment"] = "center",
13 ) {
14 if (alignment === "left") return "justify-start";
15 if (alignment === "right") return "justify-end";
16 return "justify-center";
17 }
18
19 export function getStaticDiagramTextAlignClass(
20 alignment: StaticDiagramElement["alignment"] = "center",
21 ) {
22 if (alignment === "left") return "text-left [&_*]:text-left";
23 if (alignment === "right") return "text-right [&_*]:text-right";
24 return "text-center [&_*]:text-center";
25 }
26
26 lines TYPESCRIPT