From 0604f0f67c064a6c83200392036058b1551df94e Mon Sep 17 00:00:00 2001 From: qbit982 Date: Mon, 15 Jun 2026 18:48:09 +0300 Subject: [PATCH 1/2] feat(Notification): make notification content as optional --- src/components/Notification/Notification.tsx | 11 +++-------- src/components/Notification/definitions.ts | 2 +- src/components/Notifications/__stories__/mockData.tsx | 11 +++++++++++ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/components/Notification/Notification.tsx b/src/components/Notification/Notification.tsx index 814fe0f3..e9a7f317 100644 --- a/src/components/Notification/Notification.tsx +++ b/src/components/Notification/Notification.tsx @@ -63,16 +63,11 @@ export const Notification = React.memo(function Notification(props: Props) { ) : null; let renderedContent; - if (typeof content === 'function') { + if (content) { + const node = typeof content === 'function' ? content({wrapperRef}) : content; renderedContent = (
-
{content({wrapperRef})}
-
- ); - } else { - renderedContent = ( -
-
{content}
+
{node}
); } diff --git a/src/components/Notification/definitions.ts b/src/components/Notification/definitions.ts index 958f2126..d012a0b1 100644 --- a/src/components/Notification/definitions.ts +++ b/src/components/Notification/definitions.ts @@ -24,7 +24,7 @@ export type NotificationSwipeActionsProps = export type NotificationProps = { id: string; - content: + content?: | React.ReactNode | ((props: {wrapperRef?: React.RefObject}) => React.ReactNode); diff --git a/src/components/Notifications/__stories__/mockData.tsx b/src/components/Notifications/__stories__/mockData.tsx index 8e8854fb..c9838e87 100644 --- a/src/components/Notifications/__stories__/mockData.tsx +++ b/src/components/Notifications/__stories__/mockData.tsx @@ -152,6 +152,17 @@ export const mockNotifications: NotificationProps[] = [ formattedDate: '12 seconds ago', swipeActions: notificationsMockSwipeActions, }, + { + id: 'only-title', + source: { + title: 'Yandex', + icon: svgYandexStoryIcon, + href: LINK, + }, + theme: 'info', + formattedDate: '12 seconds ago', + swipeActions: notificationsMockSwipeActions, + }, { id: 'minimum', content: Bare minimum, From 01d47db01acb4b0f57c7c500fe836d3a9c0ae9e7 Mon Sep 17 00:00:00 2001 From: qbit982 Date: Mon, 15 Jun 2026 18:48:38 +0300 Subject: [PATCH 2/2] chore(Notification): add story with no-content --- src/components/Notifications/__stories__/mockData.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/Notifications/__stories__/mockData.tsx b/src/components/Notifications/__stories__/mockData.tsx index c9838e87..537a6b82 100644 --- a/src/components/Notifications/__stories__/mockData.tsx +++ b/src/components/Notifications/__stories__/mockData.tsx @@ -160,6 +160,7 @@ export const mockNotifications: NotificationProps[] = [ href: LINK, }, theme: 'info', + title: 'You hired!', formattedDate: '12 seconds ago', swipeActions: notificationsMockSwipeActions, },