sidebar updates

This commit is contained in:
2024-06-08 20:52:14 -04:00
parent a265be2565
commit e6fbc5403d
4 changed files with 127 additions and 65 deletions
+81 -17
View File
@@ -31,27 +31,34 @@ import {
CommandSeparator,
CommandShortcut,
} from "../ui/command";
import { useRouter } from "next/navigation";
function Sidebar() {
const [isCollapsed, setIsCollapsed] = useState<boolean>(false);
const router = useRouter();
const handleClick = (redirectLink: any) => {
router.push(redirectLink);
};
const menuList = [
{
group: "Navigation",
items: [
{
link: "/dashboard",
icon: <LayoutGridIcon />,
link: "/",
icon: <LayoutGridIcon height={20} />,
text: "Dashboard",
},
{
link: "/calendar",
icon: <CalendarIcon />,
icon: <CalendarIcon height={20} />,
text: "Calendar",
},
{
link: "/porfolio",
icon: <LineChartIcon />,
icon: <LineChartIcon height={20} />,
text: "Portfolio",
},
],
@@ -61,17 +68,17 @@ function Sidebar() {
items: [
{
link: "/",
icon: <CircleDollarSignIcon />,
icon: <CircleDollarSignIcon height={20} />,
text: "Earnings",
},
{
link: "/",
icon: <ArrowLeftRightIcon />,
icon: <ArrowLeftRightIcon height={20} />,
text: "Insider Trades",
},
{
link: "/",
icon: <FileTextIcon />,
icon: <FileTextIcon height={20} />,
text: "Filings",
},
],
@@ -81,20 +88,35 @@ function Sidebar() {
return (
<div
className={cn(
isCollapsed ? "w-[75px]" : "min-w-[300px]",
isCollapsed ? "w-[75px]" : "min-w-[275px]",
"border-r border-neutral-700 min-h-screen"
)}
>
<div className="flex flex-col min-h-screen p-4">
<div className="h-12 pt-1 flex justify-center bg-primary rounded-full">
<Image
src={"/yellowbird-black.svg"}
height={10}
width={120}
alt="yellowbird"
/>
<div
className={cn(
isCollapsed ? "bg-background" : "bg-primary h-10 pt-1",
"flex justify-center rounded-full"
)}
>
{isCollapsed ? (
<Image
src={"/yellowbird-circle.svg"}
height={40}
width={40}
alt="yellowbird"
/>
) : (
<Image
src={"/yellowbird-black.svg"}
height={10}
width={120}
alt="yellowbird"
/>
)}
</div>
<Command className="pt-4 rounded-lg bg-background flex-grow">
{/* <Command className="pt-4 rounded-lg bg-background flex-grow">
<CommandList className="max-h-full">
{menuList.map((menu: any, key: number) => (
<CommandGroup heading={!isCollapsed && menu.group} key={key}>
@@ -112,7 +134,49 @@ function Sidebar() {
</CommandGroup>
))}
</CommandList>
</Command>
</Command> */}
<div
className={cn(
isCollapsed ? "pt-2" : "pt-6",
"rounded-lg bg-background flex-grow"
)}
>
<div className="max-h-full">
{menuList.map((menu: any, key: number) => (
<>
<div key={key} className="py-2">
<div className="text-muted-foreground text-sm pl-1 pb-1">
{!isCollapsed && menu.group}
</div>
{menu.items.map((option: any, optionKey: number) => (
<div
key={optionKey}
className="flex gap-2 cursor-pointer p-2 hover:bg-neutral-700 rounded-xl"
onClick={() => handleClick(option.link)}
>
<div
className={cn(
isCollapsed ? "justify-center" : "pl-1 gap-2",
"flex"
)}
>
<div className="text-muted-foreground flex items-center">
{option.icon}
</div>
{!isCollapsed && (
<span className="text-base">{option.text}</span>
)}
</div>
</div>
))}
</div>
<hr className="border-neutral-600 last:hidden" />
</>
))}
</div>
</div>
<Button
variant="ghost"
onClick={() => {