Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: sidebar navigation done #95

Merged
merged 2 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading