diff --git a/src/components/lexical/Callout.tsx b/src/components/lexical/Callout.tsx new file mode 100644 index 0000000..c48d6a9 --- /dev/null +++ b/src/components/lexical/Callout.tsx @@ -0,0 +1,22 @@ +// src/components/lexical/Callout.tsx +import type { ReactNode } from 'react' + +export function Callout({ + title, + variant = 'default', + children, +}: { + title?: string + variant?: 'default' | 'note' | 'warning' | 'tip' + children: ReactNode +}) { + return ( + + ) +} diff --git a/src/components/lexical/LinkPreviewCard.tsx b/src/components/lexical/LinkPreviewCard.tsx new file mode 100644 index 0000000..6b92cf3 --- /dev/null +++ b/src/components/lexical/LinkPreviewCard.tsx @@ -0,0 +1,34 @@ +// src/components/lexical/LinkPreviewCard.tsx +import Image from 'next/image' + +export function LinkPreviewCard({ + url, + title, + description, + imageUrl, +}: { + url: string + title?: string + description?: string + imageUrl?: string +}) { + let host = url + try { host = new URL(url).host } catch {} + return ( + +
+
{host}
+ {title &&
{title}
} + {description &&
{description}
} +
+ {imageUrl && ( + + )} +
+ ) +} diff --git a/src/components/lexical/PostImage.tsx b/src/components/lexical/PostImage.tsx new file mode 100644 index 0000000..7a0d245 --- /dev/null +++ b/src/components/lexical/PostImage.tsx @@ -0,0 +1,27 @@ +// src/components/lexical/PostImage.tsx +import Image from 'next/image' + +const widthClass: Record = { + inline: 'max-w-[24rem]', + wide: 'max-w-[56rem]', + full: '', +} + +export function PostImage({ + src, + alt, + caption, + widthHint = 'full', +}: { + src: string + alt: string + caption?: string + widthHint?: 'full' | 'wide' | 'inline' +}) { + return ( +
+ {alt} + {caption &&
{caption}
} +
+ ) +}