add hashtag block

This commit is contained in:
Ren Amamiya
2023-07-17 08:54:17 +07:00
parent 4f41022b30
commit b3b790588a
15 changed files with 203 additions and 59 deletions

View File

@@ -2,6 +2,7 @@ import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
import {
Hashtag,
ImagePreview,
LinkPreview,
MentionNote,
@@ -30,24 +31,16 @@ export function NoteContent({
del: ({ children }) => {
const key = children[0] as string;
if (key.startsWith('pub')) return <MentionUser pubkey={key.slice(3)} />;
if (key.startsWith('tag'))
return (
<button
type="button"
className="rounded bg-zinc-800 px-2 py-px text-sm font-normal text-orange-400 no-underline hover:bg-zinc-700 hover:text-orange-500"
>
{key.slice(3)}
</button>
);
if (key.startsWith('tag')) return <Hashtag tag={key.slice(3)} />;
},
}}
>
{content.parsed}
</ReactMarkdown>
{content.images.length > 0 && <ImagePreview urls={content.images} />}
{content.videos.length > 0 && <VideoPreview urls={content.videos} />}
{content.links.length > 0 && <LinkPreview urls={content.links} />}
{content.notes.length > 0 &&
{content.images?.length > 0 && <ImagePreview urls={content.images} />}
{content.videos?.length > 0 && <VideoPreview urls={content.videos} />}
{content.links?.length > 0 && <LinkPreview urls={content.links} />}
{content.notes?.length > 0 &&
content.notes.map((note: string) => <MentionNote key={note} id={note} />)}
</>
);