All files / client/src/components/ui app-tab.tsx

100% Statements 7/7
100% Branches 5/5
100% Functions 2/2
100% Lines 7/7

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          7x           7x   171x                         7x   7x       13x             7x  
import * as React from "react";
 
import { cn } from "@/lib/utils";
 
/** Shared visual root for editor tabs and semantic tab primitives. */
export const appTabClassName = "app-tab ui-type-tab";
 
interface AppTabProps extends React.HTMLAttributes<HTMLDivElement> {
  readonly active?: boolean;
}
 
export const AppTab = React.forwardRef<HTMLDivElement, AppTabProps>(
  ({ active, className, ...props }, ref) => (
    <div
      ref={ref}
      data-app-tab="true"
      {...(active === undefined ? {} : { "data-active": active ? "true" : "false" })}
      className={cn(
        appTabClassName,
        "group focus-visible:outline-hidden focus-visible:ring-0 focus-visible:ring-offset-0",
        className,
      )}
      {...props}
    />
  ),
);
AppTab.displayName = "AppTab";
 
export const AppTabMain = React.forwardRef<
  HTMLButtonElement,
  React.ButtonHTMLAttributes<HTMLButtonElement>
>(({ className, type = "button", ...props }, ref) => (
  <button
    ref={ref}
    type={type}
    className={cn("app-tab__main ui-type-tab", className)}
    {...props}
  />
));
AppTabMain.displayName = "AppTabMain";