-
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathquote-embed.tsx
More file actions
34 lines (33 loc) · 786 Bytes
/
quote-embed.tsx
File metadata and controls
34 lines (33 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { PortableText, type PortableTextComponents } from "next-sanity";
import Link from "next/link";
export default function QuoteEmbed(props: any) {
const { content, url } = props;
if (!content) {
return null;
}
const components: PortableTextComponents = {
marks: {
link: ({ children, value }) => {
return (
<Link
href={value?.href || "#"}
rel="noreferrer noopener"
target="_blank"
>
{children}
</Link>
);
},
internalLink: ({ children, value }) => {
return <Link href={value?.href || "#"}>{children}</Link>;
},
},
};
return (
<figure>
<blockquote cite={url || "#"} className="mt-6 border-l-2 pl-6 italic">
<PortableText components={components} value={content} />
</blockquote>
</figure>
);
}