All files / src/ahuora-design-system/ui shortcut.tsx

100% Statements 4/4
100% Branches 0/0
100% Functions 1/1
100% Lines 4/4

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                33x                                 33x       4886x     33x    
import { cn } from "@/lib/utils";
import { cva } from "class-variance-authority";
import React from "react";
import { R } from "vitest/dist/reporters-yx5ZTtEV.js";
 
/***
 * DO NOT use in components with shortcut component already e.g.  context menus
 */
const shortcutVariants = cva(
  "pointer-events-none inline-flex select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground opacity-100",
  {
    variants: {
      variant: {
        xs: "text-xs h-5",
        sm: "text-sm h-6",
      },
    },
    defaultVariants: {
      variant: "xs",
    },
  },
);
interface ShortcutProps extends React.HTMLAttributes<HTMLSpanElement> {
  variant?: "xs" | "sm";
}
const Shortcut = React.forwardRef<
  HTMLSpanElement,
  ShortcutProps & React.HTMLAttributes<HTMLSpanElement>
>(({ className, children, variant, ...props }, ref) => (
  <kbd className={cn(shortcutVariants({ variant }), className)}>{children}</kbd>
));
 
Shortcut.displayName = "Shortcut";
export { Shortcut };