From 9e52d2c914a5a90a6504f7a0b46d41790188647c Mon Sep 17 00:00:00 2001 From: Ivy Date: Fri, 29 Nov 2024 01:37:02 -0500 Subject: [PATCH] enhancement: Active selected link in sidebar state Update Sidebar.tsx --- ui/admin/app/components/sidebar/Sidebar.tsx | 18 ++++++++++++++++-- ui/admin/app/components/ui/sidebar.tsx | 3 ++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ui/admin/app/components/sidebar/Sidebar.tsx b/ui/admin/app/components/sidebar/Sidebar.tsx index 4cbd0cdb..3ee904fd 100644 --- a/ui/admin/app/components/sidebar/Sidebar.tsx +++ b/ui/admin/app/components/sidebar/Sidebar.tsx @@ -1,4 +1,4 @@ -import { Link } from "@remix-run/react"; +import { Link, useLocation } from "@remix-run/react"; import { BotIcon, BrainIcon, @@ -81,6 +81,7 @@ const items = [ export function AppSidebar() { const { state } = useSidebar(); + const location = useLocation(); return ( @@ -108,12 +109,25 @@ export function AppSidebar() { - + {item.title} diff --git a/ui/admin/app/components/ui/sidebar.tsx b/ui/admin/app/components/ui/sidebar.tsx index 471d0870..77a34dc9 100644 --- a/ui/admin/app/components/ui/sidebar.tsx +++ b/ui/admin/app/components/ui/sidebar.tsx @@ -415,7 +415,7 @@ const SidebarContent = React.forwardRef< ref={ref} data-sidebar="content" className={cn( - "flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden", + "flex min-h-0 flex-1 flex-col gap-2 overflow-hidden group-data-[collapsible=icon]:overflow-hidden", className )} {...props} @@ -534,6 +534,7 @@ const sidebarMenuButtonVariants = cva( "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground", outline: "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]", + spill: "w-full group-data-[collapsible=icon]:data-[active=true]:!bg-background group-data-[collapsible=icon]:data-[active=true]:!w-[calc(100%+20px)] hover:bg-background hover:w-[calc(100%+20px)] data-[active=true]:bg-background data-[active=true]:w-[calc(100%+20px)] pr-[10px]", }, size: { default: "h-8 text-sm",