From 661baca101af2177ddb61ed2be60a991b3cb31fb Mon Sep 17 00:00:00 2001 From: Ardeman Date: Sun, 23 Feb 2025 17:00:17 +0800 Subject: [PATCH] feat: add NotificationIcon component and update admin layout for improved UI --- app/components/icons/notification.tsx | 38 +++++++++++++++++++ app/components/popup/succes-register.tsx | 2 +- app/components/popup/succes-reset-pass.tsx | 2 +- app/layouts/admin/dashboard.tsx | 4 +- app/layouts/admin/navbar.tsx | 26 ++++++++++++- app/layouts/admin/sidebar.tsx | 38 ++++++++++++++----- app/routes/_layout.admin.dashboard._index.tsx | 8 +--- 7 files changed, 97 insertions(+), 21 deletions(-) create mode 100644 app/components/icons/notification.tsx diff --git a/app/components/icons/notification.tsx b/app/components/icons/notification.tsx new file mode 100644 index 0000000..e385b6a --- /dev/null +++ b/app/components/icons/notification.tsx @@ -0,0 +1,38 @@ +import type { JSX, SVGProps } from 'react' + +interface NotificationIconProperties + extends JSX.IntrinsicAttributes, + SVGProps { + showBadge?: boolean +} + +export const NotificationIcon = ({ + showBadge = false, + ...properties +}: NotificationIconProperties) => { + return ( + + + {showBadge && ( + + )} + + ) +} diff --git a/app/components/popup/succes-register.tsx b/app/components/popup/succes-register.tsx index 284ee81..2055035 100644 --- a/app/components/popup/succes-register.tsx +++ b/app/components/popup/succes-register.tsx @@ -6,7 +6,7 @@ import { APP } from '~/data/meta' export default function PopupSuccesRegister() { return ( -
+
+
{ const { children } = properties return ( -
+
-
{children}
+
{children}
) diff --git a/app/layouts/admin/navbar.tsx b/app/layouts/admin/navbar.tsx index dbf19f6..568554b 100644 --- a/app/layouts/admin/navbar.tsx +++ b/app/layouts/admin/navbar.tsx @@ -1,3 +1,27 @@ +import { Link } from 'react-router' + +import { NotificationIcon } from '~/components/icons/notification' +import { APP } from '~/data/meta' + export const Navbar = () => { - return
Navbar
+ return ( +
+ + {APP.title} + +
+ +
+
+ ) } diff --git a/app/layouts/admin/sidebar.tsx b/app/layouts/admin/sidebar.tsx index a43dda2..7acbaeb 100644 --- a/app/layouts/admin/sidebar.tsx +++ b/app/layouts/admin/sidebar.tsx @@ -1,10 +1,11 @@ -import { Link } from 'react-router' +import { NavLink } from 'react-router' +import { twMerge } from 'tailwind-merge' import { MENU } from './menu' export const Sidebar = () => { return ( -
+
{MENU.map(({ group, items }) => (
{ {group}
{items.map(({ title, url, icon: Icon }) => ( - + twMerge( + isActive ? 'bg-[#707FDD]/10 font-bold' : '', + 'group/menu flex h-[42px] w-[200px] items-center gap-x-3 rounded-md px-5 transition-all hover:bg-[#707FDD]/10', + ) + } > - - - {title} - - + {({ isActive }) => ( + <> + + + {title} + + + )} + ))}
))} diff --git a/app/routes/_layout.admin.dashboard._index.tsx b/app/routes/_layout.admin.dashboard._index.tsx index 2709cd2..c7a9a58 100644 --- a/app/routes/_layout.admin.dashboard._index.tsx +++ b/app/routes/_layout.admin.dashboard._index.tsx @@ -1,10 +1,4 @@ const DashboardIndexLayout = () => { - return ( -
-
- Dashboard Page -
-
- ) + return
Dashboard Page
} export default DashboardIndexLayout