From 72d72a550e9a6262a3760c005c31a6a8090b9fd1 Mon Sep 17 00:00:00 2001 From: Pattadon Date: Fri, 13 Sep 2024 13:56:58 +0700 Subject: [PATCH] Refactor UI components, add notification bell icon and count --- src/app/notification/page.tsx | 20 +++++- src/components/navigationBar/nav.tsx | 102 +++++++++++++++++++-------- 2 files changed, 90 insertions(+), 32 deletions(-) diff --git a/src/app/notification/page.tsx b/src/app/notification/page.tsx index e4433c5..054ef48 100644 --- a/src/app/notification/page.tsx +++ b/src/app/notification/page.tsx @@ -1,6 +1,7 @@ "use client"; import { Card, CardContent } from "@/components/ui/card"; +import { BellIcon } from "lucide-react"; export default function Notification() { const sampleNotifications = [ @@ -17,7 +18,24 @@ export default function Notification() { - 1 + + {sampleNotifications.map((notification, index) => ( +
+
+ +
+

+ {notification.message} +

+

{notification.time}

+
+
+ +
+ ))} +
diff --git a/src/components/navigationBar/nav.tsx b/src/components/navigationBar/nav.tsx index fac2336..ec17864 100644 --- a/src/components/navigationBar/nav.tsx +++ b/src/components/navigationBar/nav.tsx @@ -45,27 +45,31 @@ const landings = [ route: "/crm-landing", }, ]; -const ListItem = React.forwardRef, React.ComponentPropsWithoutRef<"a">>( - ({ className, title, children, ...props }, ref) => { - return ( -
  • - - -
    {title}
    -
    -

    {children}

    -
    -
    -
  • - ); - } -); +const ListItem = React.forwardRef< + React.ElementRef<"a">, + React.ComponentPropsWithoutRef<"a"> +>(({ className, title, children, ...props }, ref) => { + return ( +
  • + + +
    {title}
    +
    +

    + {children} +

    +
    +
    +
  • + ); +}); ListItem.displayName = "ListItem"; const unAuthenticatedComponents = () => { @@ -82,14 +86,28 @@ const unAuthenticatedComponents = () => { }; const authenticatedComponents = () => { + let notifications = 100; + const displayValue = notifications >= 100 ? "..." : notifications; return (
    - + + {" "} +
    + + + {displayValue} + +
    + -