返回 presentation-ai
pros-item.tsx
1 "use client";
2
3 import { NodeApi, PathApi } from "platejs";
4 import { PlateElement, type PlateElementProps } from "platejs/react";
5
6 import { cn } from "@/lib/utils";
7 import { type TProsConsGroupElement } from "../plugins/pros-cons-plugin";
8 import { getAlignmentClasses } from "../utils";
9
10 export const ProsItem = (props: PlateElementProps) => {
11 const parentPath = PathApi.parent(props.path);
12 const parentElement = NodeApi.get(props.editor, parentPath);
13 const { alignment = "left" } = parentElement as TProsConsGroupElement;
14 return (
15 <PlateElement
16 {...props}
17 className={cn("flex h-full flex-col rounded-lg p-6 text-white")}
18 data-bg-export="true"
19 style={{
20 background: "linear-gradient(135deg, #27ae60 0%, #229954 100%)",
21 }}
22 >
23 <div className={cn(getAlignmentClasses(alignment))}>{props.children}</div>
24 </PlateElement>
25 );
26 };
27
27 lines Plain Text