mirror of
https://github.com/dylanbenzi/yellowbird.git
synced 2026-11-27 01:07:01 +00:00
final touches
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import Image from "next/image";
|
||||
import React, { useState } from "react";
|
||||
import React, { Fragment, useState } from "react";
|
||||
import { Button } from "../ui/button";
|
||||
import { cn } from "@/lib/utils";
|
||||
import {
|
||||
@@ -34,8 +34,15 @@ import {
|
||||
} from "../ui/command";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
TooltipProvider,
|
||||
TooltipTrigger,
|
||||
} from "@/components/ui/tooltip";
|
||||
|
||||
function Sidebar() {
|
||||
const [isCollapsed, setIsCollapsed] = useState<boolean>(false);
|
||||
const [isCollapsed, setIsCollapsed] = useState<boolean>(true);
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
@@ -87,20 +94,15 @@ function Sidebar() {
|
||||
];
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
isCollapsed ? "w-[75px]" : "min-w-[275px]",
|
||||
"border-r border-neutral-700 min-h-screen"
|
||||
)}
|
||||
>
|
||||
<div className="border-r border-neutral-700 min-h-screen">
|
||||
<div
|
||||
className={cn(
|
||||
isCollapsed ? "items-center" : "",
|
||||
"pb-4 px-2 flex flex-col min-h-screen"
|
||||
isCollapsed ? "items-center w-[75px]" : "w-[250px]",
|
||||
"pb-2 px-2 flex flex-col min-h-screen"
|
||||
)}
|
||||
>
|
||||
<div
|
||||
className={cn(isCollapsed ? "" : "px-4", "h-16 flex items-center")}
|
||||
className={cn(isCollapsed ? "" : "px-2", "h-16 flex items-center")}
|
||||
>
|
||||
{isCollapsed ? (
|
||||
<Image
|
||||
@@ -108,6 +110,10 @@ function Sidebar() {
|
||||
height={40}
|
||||
width={40}
|
||||
alt="yellowbird"
|
||||
className="cursor-pointer"
|
||||
onClick={() => {
|
||||
router.push("/");
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<Image
|
||||
@@ -115,42 +121,61 @@ function Sidebar() {
|
||||
height={40}
|
||||
width={152.5}
|
||||
alt="yellowbird"
|
||||
className="cursor-pointer"
|
||||
onClick={() => {
|
||||
router.push("/");
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex-grow px-4">
|
||||
<div className="flex-grow px-2">
|
||||
<div className="max-h-full">
|
||||
{menuList.map((menu: any, key: number) => (
|
||||
<>
|
||||
<div key={key} className="py-2">
|
||||
<Fragment key={key}>
|
||||
<div 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>
|
||||
<TooltipProvider key={optionKey}>
|
||||
<Tooltip>
|
||||
<TooltipTrigger className="w-full">
|
||||
<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>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent
|
||||
className={cn(
|
||||
isCollapsed ? "" : "hidden",
|
||||
"border-0 bg-background drop-shadow-lg"
|
||||
)}
|
||||
side="right"
|
||||
>
|
||||
{option.text}
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
))}
|
||||
</div>
|
||||
<hr className="border-neutral-600 last:hidden" />
|
||||
</>
|
||||
</Fragment>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
@@ -181,8 +206,8 @@ function Sidebar() {
|
||||
</div>
|
||||
<div
|
||||
className={cn(
|
||||
isCollapsed ? "justify-center" : "",
|
||||
"p-2 bg-secondary rounded-lg flex items-center"
|
||||
isCollapsed ? "justify-center p-2" : "pl-2",
|
||||
"rounded-lg flex items-center"
|
||||
)}
|
||||
>
|
||||
<Button variant="default" className="w-8 h-8 rounded-full">
|
||||
@@ -197,7 +222,7 @@ function Sidebar() {
|
||||
</p>
|
||||
</div>
|
||||
<Button variant="ghost" className="">
|
||||
<LogOutIcon width={20} height={20} className="text-red-500" />
|
||||
<LogOutIcon width={15} height={20} className="text-red-500" />
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
import * as TooltipPrimitive from "@radix-ui/react-tooltip"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const TooltipProvider = TooltipPrimitive.Provider
|
||||
|
||||
const Tooltip = TooltipPrimitive.Root
|
||||
|
||||
const TooltipTrigger = TooltipPrimitive.Trigger
|
||||
|
||||
const TooltipContent = React.forwardRef<
|
||||
React.ElementRef<typeof TooltipPrimitive.Content>,
|
||||
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
|
||||
>(({ className, sideOffset = 4, ...props }, ref) => (
|
||||
<TooltipPrimitive.Content
|
||||
ref={ref}
|
||||
sideOffset={sideOffset}
|
||||
className={cn(
|
||||
"z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
))
|
||||
TooltipContent.displayName = TooltipPrimitive.Content.displayName
|
||||
|
||||
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
|
||||
Reference in New Issue
Block a user