| 1 | "use client"; |
| 2 | |
| 3 | import { SlateElement, type SlateElementProps } from "platejs/static"; |
| 4 | |
| 5 | import { cn } from "@/lib/utils"; |
| 6 | import { type TIconElement } from "../../plugins/icon-plugin"; |
| 7 | import { PresentationIcon } from "../presentation-icon"; |
| 8 | |
| 9 | export function IconStatic(props: SlateElementProps<TIconElement>) { |
| 10 | const { name, query } = props.element; |
| 11 | const icon = name || query; |
| 12 | |
| 13 | return ( |
| 14 | <SlateElement |
| 15 | {...props} |
| 16 | className={cn("inline-flex justify-center", props.className)} |
| 17 | > |
| 18 | {icon ? ( |
| 19 | <div className="mb-2 p-2"> |
| 20 | <PresentationIcon |
| 21 | icon={icon} |
| 22 | className="flex size-10 items-center justify-center rounded-md border bg-transparent! shadow-xs" |
| 23 | /> |
| 24 | </div> |
| 25 | ) : null} |
| 26 | {props.children} |
| 27 | </SlateElement> |
| 28 | ); |
| 29 | } |
| 30 |