Skip to content

Commit e46616d

Browse files
authored
Merge pull request #16 from codeunia-dev/sidebarfinal
Add background pattern to UsersPage and highlight active sidebar item
2 parents 600ce86 + f10ec4c commit e46616d

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

app/admin/users/page.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,17 @@ export default function UsersPage() {
146146

147147
return (
148148
<div className="space-y-8 md:space-y-14 min-h-screen px-4 py-8 md:px-8 lg:px-16 relative overflow-x-hidden">
149+
<div className="pointer-events-none fixed inset-0 z-0 opacity-60 select-none" aria-hidden>
150+
<svg width="100%" height="100%" className="w-full h-full">
151+
<defs>
152+
<radialGradient id="bgPattern" cx="50%" cy="50%" r="80%">
153+
<stop offset="0%" stopColor="#a5b4fc" stopOpacity="0.12" />
154+
<stop offset="100%" stopColor="#818cf8" stopOpacity="0.04" />
155+
</radialGradient>
156+
</defs>
157+
<rect width="100%" height="100%" fill="url(#bgPattern)" />
158+
</svg>
159+
</div>
149160
<div className="flex items-center gap-3 pb-6 border-b border-zinc-800/60 relative z-10 mt-2 mb-4">
150161
<span className="inline-block w-2 h-6 sm:h-8 bg-gradient-to-b from-blue-400 to-pink-400 rounded-full mr-2" />
151162
<div>

components/admin/Sidebar.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { useState } from "react";
22
import Link from "next/link";
3+
import { usePathname } from "next/navigation";
34
import {
45
Code2,
56
Bell,
@@ -28,7 +29,6 @@ import {
2829
SidebarMenuButton,
2930
SidebarMenuItem,
3031
SidebarProvider,
31-
SidebarTrigger,
3232
} from "@/components/ui/sidebar"
3333
import { Button } from "@/components/ui/button"
3434
import { Sheet, SheetContent, SheetTrigger } from "@/components/ui/sheet"
@@ -56,6 +56,7 @@ interface SidebarProps {
5656
export function Sidebar({ avatar, name, email, role, sidebarItems, children }: SidebarProps) {
5757
const [mobileOpen, setMobileOpen] = useState(false);
5858
const closeSidebar = () => setMobileOpen(false);
59+
const pathname = usePathname();
5960
return (
6061
<SidebarProvider>
6162
<div className="w-full bg-zinc-900">
@@ -93,7 +94,7 @@ export function Sidebar({ avatar, name, email, role, sidebarItems, children }: S
9394
<Link
9495
key={item.title}
9596
href={item.url}
96-
className="flex items-center gap-3 px-4 py-2 rounded-lg transition-all hover:bg-purple-700/10 active:bg-purple-800/20 text-zinc-200 hover:text-white font-medium"
97+
className={`flex items-center gap-3 px-4 py-2 rounded-lg transition-all hover:bg-purple-700/10 active:bg-purple-800/20 text-zinc-200 hover:text-white font-medium ${pathname === item.url ? "bg-purple-800/30 text-white" : ""}`}
9798
onClick={closeSidebar}
9899
>
99100
<span className="text-purple-400">
@@ -193,7 +194,7 @@ export function Sidebar({ avatar, name, email, role, sidebarItems, children }: S
193194
<SidebarMenu>
194195
{group.items.map((item) => (
195196
<SidebarMenuItem key={item.title}>
196-
<SidebarMenuButton asChild className="group flex items-center gap-3 px-6 py-2 rounded-lg transition-all hover:bg-purple-700/10 active:bg-purple-800/20 focus:bg-purple-800/20 text-zinc-200 hover:text-white font-medium">
197+
<SidebarMenuButton asChild className={`group flex items-center gap-3 px-6 py-2 rounded-lg transition-all hover:bg-purple-700/10 active:bg-purple-800/20 focus:bg-purple-800/20 text-zinc-200 hover:text-white font-medium ${pathname === item.url ? "bg-purple-800/30 text-white" : ""}`}>
197198
<Link href={item.url} className="flex items-center w-full">
198199
<span className="mr-3 text-purple-400 group-hover:text-purple-300">
199200
{React.createElement(item.icon, { className: "size-5" })}
@@ -270,7 +271,6 @@ export function Sidebar({ avatar, name, email, role, sidebarItems, children }: S
270271
<SidebarInset>
271272
<header className="flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-[[data-collapsible=icon]]/sidebar-wrapper:h-12 px-4 pl-14 md:pl-0 border-b border-zinc-800 bg-[#10172a]">
272273
<div className="flex items-center gap-2">
273-
<SidebarTrigger className="-ml-1 hidden md:block" />
274274
<div className="h-4 w-px bg-sidebar-border hidden md:block" />
275275
<div className="flex items-center gap-2">
276276
<span className="font-semibold text-white">Admin Dashboard</span>

0 commit comments

Comments
 (0)