| 1 | import { NodeApi, PathApi } from "platejs"; |
| 2 | import { SlateElement, type SlateElementProps } from "platejs/static"; |
| 3 | |
| 4 | import { cn } from "@/lib/utils"; |
| 5 | import { getAlignmentClasses } from "../../utils"; |
| 6 | |
| 7 | export function ConsItemStatic(props: SlateElementProps) { |
| 8 | const path = props.editor.api.findPath(props.element) ?? [-1]; |
| 9 | const parentPath = PathApi.parent(path); |
| 10 | const parentElement = NodeApi.get(props.editor, parentPath); |
| 11 | const { alignment = "left" } = parentElement as { |
| 12 | alignment?: "left" | "center" | "right"; |
| 13 | }; |
| 14 | |
| 15 | return ( |
| 16 | <div |
| 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, #e74c3c 0%, #c0392b 100%)", |
| 21 | }} |
| 22 | > |
| 23 | <SlateElement {...props} className={cn(getAlignmentClasses(alignment))}> |
| 24 | {props.children} |
| 25 | </SlateElement> |
| 26 | </div> |
| 27 | ); |
| 28 | } |
| 29 |