All files / src/pages/flowsheet-page/flowsheet ResizableHandle.tsx

50% Statements 2/4
75% Branches 3/4
33.33% Functions 1/3
50% Lines 2/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                          1754x   1754x                                  
import React, { useCallback, useEffect, useState } from "react";
import { cn } from "@/lib/utils";
 
interface ResizableHandleProps extends React.HTMLAttributes<HTMLDivElement> {
  id?: string;
  isDragging: boolean;
}
 
function ResizableHandle({
  id = "drag-bar",
  isDragging,
  ...props
}: ResizableHandleProps) {
  const [isFocused, setIsFocused] = useState(false);
 
  return (
    <div
      tabIndex={0}
      className={cn(
        "sample-drag-bar",
        (isDragging || isFocused) && "sample-drag-bar--dragging",
      )}
      onFocus={() => setIsFocused(true)}
      onBlur={() => setIsFocused(false)}
      {...props}
      id={id}
      data-testid={id}
    />
  );
}
 
export default ResizableHandle;