Skip to content

Commit 74e36bf

Browse files
committed
fix(app): customize Inbox component
1 parent bb083a5 commit 74e36bf

File tree

1 file changed

+31
-10
lines changed

1 file changed

+31
-10
lines changed

apps/app/src/components/notifications/notification-bell.tsx

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { usePathname } from 'next/navigation';
44
import { env } from '@/env.mjs';
55
import { Inbox } from '@novu/nextjs';
66
import { useSession } from '@/utils/auth-client';
7+
import { Bell, Settings } from 'lucide-react';
78

89
export function NotificationBell() {
910
const applicationIdentifier = env.NEXT_PUBLIC_NOVU_APPLICATION_IDENTIFIER;
@@ -17,20 +18,40 @@ export function NotificationBell() {
1718
return null;
1819
}
1920

21+
const appearance = {
22+
icons: {
23+
bell: () => <Bell size={20} />,
24+
cogs: () => <Settings size={20} />,
25+
},
26+
elements: {
27+
popoverContent: {
28+
right: '8px',
29+
left: 'auto !important',
30+
marginTop: '8px',
31+
width: '360px',
32+
},
33+
notificationDot: {
34+
backgroundColor: 'hsl(var(--primary))',
35+
},
36+
notificationBar: ({ notification }: { notification: any }) => {
37+
return notification.isRead ? 'bg-transparent' : 'bg-primary';
38+
}
39+
}
40+
};
41+
2042
return (
2143
<Inbox
2244
applicationIdentifier={applicationIdentifier}
2345
subscriber={`${sessionData.userId}-${orgId}`}
24-
appearance={{
25-
elements: {
26-
popoverContent: {
27-
right: '8px',
28-
left: 'auto !important',
29-
marginTop: '8px',
30-
width: '360px',
31-
},
32-
},
33-
}}
46+
appearance={appearance}
47+
renderSubject={(notification) => <strong>{notification.subject}</strong>}
48+
renderBody={(notification) => (
49+
<div className="mt-1">
50+
<p className="text-xs text-muted-foreground">
51+
{notification.body}
52+
</p>
53+
</div>
54+
)}
3455
/>
3556
);
3657
}

0 commit comments

Comments
 (0)