Skip to content

Commit

Permalink
Added custom bell icon for novu notification center
Browse files Browse the repository at this point in the history
  • Loading branch information
ad956 committed Jun 7, 2024
1 parent d755304 commit 729ac65
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions app/(pages)/patient/components/Notifications/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"use client";

import { CiBellOn } from "react-icons/ci";
import {
NovuProvider,
PopoverNotificationCenter,
NotificationBell,
} from "@novu/notification-center";

export default function Notifications({ patientId }: { patientId: string }) {
Expand All @@ -13,8 +13,42 @@ export default function Notifications({ patientId }: { patientId: string }) {
applicationIdentifier={process.env.NEXT_PUBLIC_NOVU_APP_IDENTIFIER || ""}
>
<PopoverNotificationCenter colorScheme={"light"}>
{({ unseenCount }) => <NotificationBell unseenCount={unseenCount} />}
{({ unseenCount }) => <CustomBellIcon unseenCount={unseenCount} />}
</PopoverNotificationCenter>
</NovuProvider>
);
}

const CustomBellIcon = ({
unseenCount = 0,
}: {
unseenCount: number | undefined;
}) => {
return (
<CiBellOn
size={25}
color={unseenCount > 0 ? "red" : "black"}
style={{
cursor: "pointer",
}}
>
{unseenCount > 0 && (
<span
style={{
position: "absolute",
top: "50%",
right: "5px",
transform: "translateY(-50%)",
fontSize: "12px",
color: "white",
backgroundColor: "red",
borderRadius: "50%",
padding: "2px",
}}
>
{unseenCount}
</span>
)}
</CiBellOn>
);
};

0 comments on commit 729ac65

Please sign in to comment.