All files / src/pages/flowsheet-page/flowsheet/LeftSideBar sidebar-structure.tsx

100% Statements 2/2
80% Branches 4/5
100% Functions 1/1
100% Lines 2/2

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 47 48 49 50                                      33x           1077x                                                
import { Button } from "@/ahuora-design-system/ui/button";
import { ScrollArea, ScrollBar } from "@/ahuora-design-system/ui/scroll-area";
import { ToolTipCover } from "@/ahuora-design-system/ui/tooltip";
import { cn } from "@/lib/utils";
import { type VariantProps } from "class-variance-authority";
import * as React from "react";
 
//Only apply when there are no tabs
interface NoTabsLeftSideBar {
  title: string;
  body: React.ReactNode;
  noBodyMargin?: boolean;
  barButton?: {
    onClick?: () => void;
    icon: React.ReactNode;
    tooltipContent: string;
  };
}
 
export const NoTabsLeftSideBar: React.FC<NoTabsLeftSideBar> = ({
  title,
  body,
  barButton,
  noBodyMargin = false,
}) => {
  return (
    <div className="flex flex-col gap w-full">
      <div className="flex flex-row bg-muted w-full py-1.5 px-2 justify-between items-center">
        <h3 className="flex-1">{title}</h3>
        {barButton && (
          <ToolTipCover asChild content={barButton.tooltipContent}>
            <Button
              onClick={barButton.onClick}
              size={"icon"}
              variant="secondary"
              className="w-5 h-5"
            >
              {barButton.icon}
            </Button>
          </ToolTipCover>
        )}
      </div>
      <ScrollArea className={cn(noBodyMargin ? "" : "p-2", "h-screen")}>
        <div className="mb-30">{body}</div>
        <ScrollBar orientation="vertical" />
      </ScrollArea>
    </div>
  );
};