Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

feat(web): give the active sidebar item a raised glassy look

Tina8d0de4b221c
diff --git a/apps/web/src/components/ui/sidebar.tsx b/apps/web/src/components/ui/sidebar.tsx
index 0431ddb07..9b82c0660 100644
--- a/apps/web/src/components/ui/sidebar.tsx
+++ b/apps/web/src/components/ui/sidebar.tsx
@@ -479,7 +479,7 @@ function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">) {
}
const sidebarMenuButtonVariants = cva(
- "peer/menu-button flex w-full cursor-pointer items-center gap-2 overflow-hidden rounded-lg p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pe-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-popup-open:hover:bg-sidebar-accent data-popup-open:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg:not([class*='size-'])]:size-4 [&>svg]:shrink-0",
+ "peer/menu-button flex w-full cursor-pointer items-center gap-2 overflow-hidden rounded-lg p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pe-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-(image:--sidebar-active) data-[active=true]:font-medium data-[active=true]:shadow-(--sidebar-active-shadow) data-[active=true]:text-sidebar-accent-foreground data-popup-open:hover:bg-sidebar-accent data-popup-open:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg:not([class*='size-'])]:size-4 [&>svg]:shrink-0",
{
defaultVariants: {
size: "default",
@@ -686,7 +686,7 @@ function SidebarMenuSubButton({
const defaultProps = {
className: cn(
"-translate-x-px flex h-7 min-w-0 items-center gap-2 overflow-hidden rounded-lg px-2 text-sidebar-foreground outline-hidden ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg:not([class*='size-'])]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground",
- "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
+ "data-[active=true]:bg-(image:--sidebar-active) data-[active=true]:text-sidebar-accent-foreground data-[active=true]:shadow-(--sidebar-active-shadow)",
size === "sm" && "text-xs",
size === "md" && "text-sm",
"group-data-[collapsible=icon]:hidden",
diff --git a/apps/web/src/index.css b/apps/web/src/index.css
index 2825f1a99..0f68daac5 100644
--- a/apps/web/src/index.css
+++ b/apps/web/src/index.css
@@ -234,6 +234,16 @@ input:-webkit-autofill:active {
--sidebar-accent-foreground: var(--color-neutral-800);
--sidebar-border: --alpha(var(--color-black) / 6%);
--sidebar-ring: var(--color-neutral-400);
+ --sidebar-active: linear-gradient(
+ to bottom,
+ var(--color-white),
+ var(--color-neutral-100)
+ );
+ --sidebar-active-shadow:
+ inset 0 1px 0 var(--color-white),
+ 0 0 0 1px --alpha(var(--color-black) / 7%),
+ 0 1px 2px --alpha(var(--color-black) / 6%),
+ 0 2px 6px --alpha(var(--color-black) / 3%);
--code: var(--color-white);
--code-foreground: var(--foreground);
--code-highlight: --alpha(var(--color-black) / 4%);
@@ -328,6 +338,15 @@ input:-webkit-autofill:active {
--sidebar-accent-foreground: var(--color-neutral-100);
--sidebar-border: --alpha(var(--color-white) / 5%);
--sidebar-ring: var(--color-neutral-400);
+ --sidebar-active: linear-gradient(
+ to bottom,
+ --alpha(var(--color-white) / 9%),
+ --alpha(var(--color-white) / 4%)
+ );
+ --sidebar-active-shadow:
+ inset 0 1px 0 --alpha(var(--color-white) / 8%),
+ 0 0 0 1px --alpha(var(--color-white) / 6%),
+ 0 1px 2px --alpha(var(--color-black) / 40%);
--code: color-mix(in srgb, var(--background) 98%, var(--color-white));
--code-foreground: var(--foreground);
--code-highlight: --alpha(var(--color-white) / 4%);