MCPcopy Create free account
hub / github.com/GreatStackDev/gocart / StoreSidebar

Function StoreSidebar

components/store/StoreSidebar.jsx:7–38  ·  view source on GitHub ↗
({storeInfo})

Source from the content-addressed store, hash-verified

5import Link from "next/link"
6
7const StoreSidebar = ({storeInfo}) => {
8
9 const pathname = usePathname()
10
11 const sidebarLinks = [
12 { name: 'Dashboard', href: '/store', icon: HomeIcon },
13 { name: 'Add Product', href: '/store/add-product', icon: SquarePlusIcon },
14 { name: 'Manage Product', href: '/store/manage-product', icon: SquarePenIcon },
15 { name: 'Orders', href: '/store/orders', icon: LayoutListIcon },
16 ]
17
18 return (
19 <div className="inline-flex h-full flex-col gap-5 border-r border-slate-200 sm:min-w-60">
20 <div className="flex flex-col gap-3 justify-center items-center pt-8 max-sm:hidden">
21 <Image className="w-14 h-14 rounded-full shadow-md" src={storeInfo?.logo} alt="" width={80} height={80} />
22 <p className="text-slate-700">{storeInfo?.name}</p>
23 </div>
24
25 <div className="max-sm:mt-6">
26 {
27 sidebarLinks.map((link, index) => (
28 <Link key={index} href={link.href} className={`relative flex items-center gap-3 text-slate-500 hover:bg-slate-50 p-2.5 transition ${pathname === link.href && 'bg-slate-100 sm:text-slate-600'}`}>
29 <link.icon size={18} className="sm:ml-5" />
30 <p className="max-sm:hidden">{link.name}</p>
31 {pathname === link.href && <span className="absolute bg-green-500 right-0 top-1.5 bottom-1.5 w-1 sm:w-1.5 rounded-l"></span>}
32 </Link>
33 ))
34 }
35 </div>
36 </div>
37 )
38}
39
40export default StoreSidebar

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected