Skip to content

Commit

Permalink
Merge pull request #95 from JasimIhsan/frontend
Browse files Browse the repository at this point in the history
feat: sidebar navigation done
  • Loading branch information
AJMALAJU3 authored Feb 25, 2025
2 parents aa99748 + 8f4ec15 commit 12bf8b8
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 80 deletions.
152 changes: 73 additions & 79 deletions frontend/src/components/user/common/AppSidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,86 +1,80 @@
import { Calendar, Home, Inbox, Search, Settings } from "lucide-react";
import LightLogo from "../../../assets/Logo Light.svg"
import DarkLogo from "../../../assets/Logo Dark.svg"

import {
Sidebar,
SidebarContent,
SidebarGroup,
SidebarGroupContent,
SidebarGroupLabel,
SidebarHeader,
SidebarMenu,
SidebarMenuButton,
SidebarMenuItem,
} from "@/components/ui/sidebar";
import { UserRound, Newspaper, Search, SquareActivity, Plus } from "lucide-react";
import LightLogo from "../../../assets/Logo Light.svg";
import DarkLogo from "../../../assets/Logo Dark.svg";
import { Sidebar, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarMenu, SidebarMenuButton, SidebarMenuItem } from "@/components/ui/sidebar";
import { DropdownMenu, DropdownMenuTrigger } from "../../ui/dropdown-menu";
import Button from "@/components/ui/button";
import { Link } from "react-router-dom";

const items = [
{
title: "Home",
url: "#",
icon: Home,
},
{
title: "Inbox",
url: "#",
icon: Inbox,
},
{
title: "Calendar",
url: "#",
icon: Calendar,
},
{
title: "Search",
url: "#",
icon: Search,
},
{
title: "Settings",
url: "#",
icon: Settings,
},
{
title: "My feed",
url: "/home",
icon: Newspaper,
},
{
title: "Explore",
url: "/explore",
icon: Search,
},
{
title: "Activity",
url: "/activity",
icon: SquareActivity,
},
{
title: "Profile",
url: "/profile",
icon: UserRound,
},
];

export function AppSidebar() {
return (
<Sidebar>
<SidebarHeader>
<SidebarMenu>
<SidebarMenuItem>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<SidebarMenuButton size="lg">
<div className="w-full flex justify-center items-center">
<img src={LightLogo} alt="" className="max-w-[100px] dark:hidden"/>
<img src={DarkLogo} alt="" className="max-w-[100px] dark:block hidden"/>
</div>
</SidebarMenuButton>
</DropdownMenuTrigger>
</DropdownMenu>
</SidebarMenuItem>
</SidebarMenu>
</SidebarHeader>
<SidebarContent>
<SidebarGroup>
<SidebarGroupLabel>Application</SidebarGroupLabel>
<SidebarGroupContent>
<SidebarMenu>
{items.map((item) => (
<SidebarMenuItem key={item.title}>
<SidebarMenuButton asChild>
<a href={item.url}>
<item.icon />
<span>{item.title}</span>
</a>
</SidebarMenuButton>
</SidebarMenuItem>
))}
</SidebarMenu>
</SidebarGroupContent>
</SidebarGroup>
</SidebarContent>
</Sidebar>
);

return (
<Sidebar>
<SidebarHeader>
<SidebarMenu>
<SidebarMenuItem>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<SidebarMenuButton size="lg">
<div className="w-full flex justify-center items-center">
<img src={LightLogo} alt="" className="max-w-[100px] dark:hidden" />
<img src={DarkLogo} alt="" className="max-w-[100px] dark:block hidden" />
</div>
</SidebarMenuButton>
</DropdownMenuTrigger>
</DropdownMenu>
</SidebarMenuItem>
</SidebarMenu>
</SidebarHeader>
<SidebarContent>
<SidebarGroup>
<SidebarGroupLabel>
<Button className="w-full mt-1.5 mb-1.5 h-[32px]">
{" "}
<Plus /> New Post
</Button>
</SidebarGroupLabel>
<SidebarGroupContent className="mt-2">
<SidebarMenu>
{items.map((item) => (
<SidebarMenuItem key={item.title}>
<SidebarMenuButton asChild>
<Link to={item.url}>
<button className="flex justify-center items-center gap-4">
<item.icon size={18} strokeWidth={2}/>
<span>{item.title}</span>
</button>
</Link>
</SidebarMenuButton>
</SidebarMenuItem>
))}
</SidebarMenu>
</SidebarGroupContent>
</SidebarGroup>
</SidebarContent>
</Sidebar>
);
}
4 changes: 3 additions & 1 deletion frontend/src/router/AppRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ export const router = createBrowserRouter([
path: "/",
element:<AppLayout />,
children: [
{ path: "home" , element: <div> home </div>},
{ path: "home" , element: <div> Feeds </div>},
{ path: "explore" , element: <div> Explore </div>},
{ path: "activity" , element: <div> Activity </div>},
{ path: "profile", element: <Profile /> },
],
},
Expand Down

0 comments on commit 12bf8b8

Please sign in to comment.