Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite8d5f98

Browse files
feat: support markdown in notifications (#17075)
To make the notification content more appealing, we are sending thenotification content as markdown from the server, so we need to adjustthe FE to display it properly.
1 parent5b3eda6 commite8d5f98

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

‎site/src/modules/notifications/NotificationsInbox/InboxItem.stories.tsx‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ export const LongText: Story = {
4848
},
4949
};
5050

51+
exportconstMarkdown:Story={
52+
args:{
53+
notification:{
54+
...MockNotification,
55+
read_at:null,
56+
content:"Hello **world**!",
57+
},
58+
},
59+
};
60+
5161
exportconstUnreadFocus:Story={
5262
args:{
5363
notification:{

‎site/src/modules/notifications/NotificationsInbox/InboxItem.tsx‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import { Avatar } from "components/Avatar/Avatar";
33
import{Button}from"components/Button/Button";
44
import{SquareCheckBig}from"lucide-react";
55
importtype{FC}from"react";
6+
importMarkdownfrom"react-markdown";
67
import{LinkasRouterLink}from"react-router-dom";
8+
import{cn}from"utils/cn";
79
import{relativeTime}from"utils/time";
810

911
typeInboxItemProps={
@@ -26,8 +28,13 @@ export const InboxItem: FC<InboxItemProps> = ({
2628
</div>
2729

2830
<divclassName="flex flex-col gap-3 flex-1">
29-
<spanclassName="text-content-secondary text-sm font-medium whitespace-break-spaces [overflow-wrap:anywhere]">
30-
{notification.content}
31+
<span
32+
className={cn([
33+
"text-content-secondary text-sm font-medium whitespace-break-spaces [overflow-wrap:anywhere]",
34+
"[&_p]:m-0",
35+
])}
36+
>
37+
<Markdown>{notification.content}</Markdown>
3138
</span>
3239
<divclassName="flex items-center gap-1">
3340
{notification.actions.map((action)=>{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp