| 1 | import { FileUp } from "lucide-react"; |
| 2 | import { type TFileElement } from "platejs"; |
| 3 | import { SlateElement, type SlateElementProps } from "platejs/static"; |
| 4 | |
| 5 | export function FileElementStatic(props: SlateElementProps<TFileElement>) { |
| 6 | const { name, url } = props.element; |
| 7 | |
| 8 | return ( |
| 9 | <SlateElement className="my-px rounded-sm" {...props}> |
| 10 | <a |
| 11 | className="group relative m-0 flex cursor-pointer items-center rounded px-0.5 py-0.75 hover:bg-muted" |
| 12 | contentEditable={false} |
| 13 | download={name} |
| 14 | href={url} |
| 15 | rel="noopener noreferrer" |
| 16 | role="button" |
| 17 | target="_blank" |
| 18 | > |
| 19 | <div className="flex items-center gap-1 p-1"> |
| 20 | <FileUp className="size-5" /> |
| 21 | <div>{name}</div> |
| 22 | </div> |
| 23 | </a> |
| 24 | {props.children} |
| 25 | </SlateElement> |
| 26 | ); |
| 27 | } |
| 28 |