feat: mentions

This commit is contained in:
Alejandro Gomez
2023-06-28 10:21:03 +02:00
committed by Kieran
parent 0c8fbcfef1
commit 4aafb19f7e
9 changed files with 243 additions and 22 deletions

25
src/element/hypertext.tsx Normal file
View File

@ -0,0 +1,25 @@
import { NostrLink } from "./nostr-link";
interface HyperTextProps {
link: string;
}
export function HyperText({ link }: HyperTextProps) {
try {
const url = new URL(link);
if (url.protocol === "nostr:" || url.protocol === "web+nostr:") {
return <NostrLink link={link} />;
} else {
<a href={link} target="_blank" rel="noreferrer">
{link}
</a>;
}
} catch {
// Ignore the error.
}
return (
<a href={link} target="_blank" rel="noreferrer">
{link}
</a>
);
}