| 1 | import { type TElement } from "platejs"; |
| 2 | import { SlateElement, type SlateElementProps } from "platejs/static"; |
| 3 | |
| 4 | type TBlockquoteElement = TElement & { |
| 5 | author?: string; |
| 6 | }; |
| 7 | |
| 8 | export function BlockquoteElementStatic( |
| 9 | props: SlateElementProps<TBlockquoteElement>, |
| 10 | ) { |
| 11 | const { children, element, ...slateProps } = props; |
| 12 | const author = element.author ?? ""; |
| 13 | |
| 14 | return ( |
| 15 | <SlateElement |
| 16 | as="blockquote" |
| 17 | className="my-1 border-l-2 pl-6 italic" |
| 18 | element={element} |
| 19 | {...slateProps} |
| 20 | > |
| 21 | {children} |
| 22 | {author && ( |
| 23 | <footer className="mt-2 text-sm text-muted-foreground"> |
| 24 | - {author} |
| 25 | </footer> |
| 26 | )} |
| 27 | </SlateElement> |
| 28 | ); |
| 29 | } |
| 30 |