返回 presentation-ai
stats.tsx
1 "use client";
2
3 import { PlateElement, type PlateElementProps } from "platejs/react";
4
5 import { cn } from "@/lib/utils";
6 import { type TStatsGroupElement } from "../plugins/stats-plugin";
7 import {
8 columnSizeVariant,
9 getAlignmentClasses,
10 getDefaultColumnSize,
11 } from "../utils";
12
13 export default function StatsGroup(
14 props: PlateElementProps<TStatsGroupElement>,
15 ) {
16 const { alignment = "left" } = props.element;
17 const columnSize =
18 props.element.columnSize ??
19 getDefaultColumnSize(props.element.children.length);
20
21 return (
22 <PlateElement {...props} className="relative mb-4 w-full max-w-full">
23 <div
24 className={cn(
25 "w-full max-w-full min-w-0",
26 columnSizeVariant({ columnSize }),
27 getAlignmentClasses(alignment),
28 )}
29 >
30 {props.children}
31 </div>
32 </PlateElement>
33 );
34 }
35
35 lines Plain Text