feat: add NotificationIcon component and update admin layout for improved UI

This commit is contained in:
Ardeman
2025-02-23 17:00:17 +08:00
parent 15f8dbb8e2
commit 661baca101
7 changed files with 97 additions and 21 deletions
+2 -2
View File
@@ -6,11 +6,11 @@ import { Sidebar } from './sidebar'
export const AdminDashboardLayout = (properties: PropsWithChildren) => {
const { children } = properties
return (
<div className="grid">
<div className="flex flex-col">
<Navbar />
<div className="flex">
<Sidebar />
<div>{children}</div>
<div className="min-h-[calc(100dvh-80px)] flex-1">{children}</div>
</div>
</div>
)
+25 -1
View File
@@ -1,3 +1,27 @@
import { Link } from 'react-router'
import { NotificationIcon } from '~/components/icons/notification'
import { APP } from '~/data/meta'
export const Navbar = () => {
return <div>Navbar</div>
return (
<div className="flex h-20 items-center justify-between border-b border-[#ECECEC] bg-white px-10 py-5">
<Link
to="/news"
className="h-full"
>
<img
src={APP.logo}
alt={APP.title}
className="h-3/4 w-auto sm:h-full"
/>
</Link>
<div>
<NotificationIcon
className="text-[#B0C3CC]"
showBadge={true}
/>
</div>
</div>
)
}
+29 -9
View File
@@ -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 (
<div className="flex flex-col gap-y-10 p-5">
<div className="flex min-h-[calc(100dvh-80px)] flex-col gap-y-10 overflow-y-auto bg-white p-5">
{MENU.map(({ group, items }) => (
<div className="flex flex-col">
<div
@@ -14,16 +15,35 @@ export const Sidebar = () => {
{group}
</div>
{items.map(({ title, url, icon: Icon }) => (
<Link
<NavLink
to={url}
key={`${group}-${title}`}
className="group/menu hover:bg-opacity-10 flex h-[42px] w-[200px] items-center gap-x-3 rounded-md px-5 transition-all hover:bg-[#707FDD]/10 hover:font-bold hover:text-[#5363AB]"
className={({ isActive }) =>
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',
)
}
>
<Icon className="h-[18px] w-[18px] text-[#A6ABC8] transition-all group-hover/menu:text-[#5363AB]" />
<span className="text-[#273240] transition-all group-hover/menu:text-[#5363AB]">
{title}
</span>
</Link>
{({ isActive }) => (
<>
<Icon
className={twMerge(
isActive ? 'text-[#5363AB]' : 'text-[#A6ABC8]',
'h-[18px] w-[18px] transition-all group-hover/menu:text-[#5363AB]',
)}
/>
<span
className={twMerge(
isActive ? 'text-[#5363AB]' : 'text-[#273240]',
'transition-all group-hover/menu:text-[#5363AB]',
)}
>
{title}
</span>
</>
)}
</NavLink>
))}
</div>
))}