# All files / src/components/ui/sidebar-menu SidebarMenuSubButton.tsx

0% Statements 0/45
0% Branches 0/1
0% Functions 0/1
0% Lines 0/45

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46

     "use client"

    import { ComponentProps } from "react"
    import { cn } from "@/lib/utils"

    export function SidebarMenuSubButton({
      asChild = false,
      size = "md",
      isActive = false,
      className,
      ...props
    }: ComponentProps<"a"> & {
      asChild?: boolean
      size?: "sm" | "md"
      isActive?: boolean
    }) {
      const Comp = asChild ? "div" : "a"

      return (
        <Comp
          data-slot="sidebar-menu-sub-button"
          data-sidebar="menu-sub-button"
          data-size={size}
          data-active={isActive}
          className={cn(
            "mat-mdc-list-item",
            "flex h-7 min-w-0 items-center gap-2",
            "overflow-hidden rounded-md px-2",
            "hover:bg-gray-200 dark:hover:bg-gray-700",
            "active:bg-gray-300 dark:active:bg-gray-600",
            "focus-visible:ring-2 focus-visible:ring-offset-2",
            "disabled:pointer-events-none disabled:opacity-50",
            "aria-disabled:pointer-events-none aria-disabled:opacity-50",
            "[&>span:last-child]:truncate",
            "[&>svg]:w-4 [&>svg]:h-4 [&>svg]:shrink-0",
            isActive && "bg-gray-300 dark:bg-gray-600",
            size === "sm" && "text-xs",
            size === "md" && "text-sm",
            "group-data-[collapsible=icon]:hidden",
            className
          )}
          {...props}
        />
      )
    }