All files / react-app/src/components/Inputs textarea.tsx

100% Statements 3/3
50% Branches 4/8
100% Functions 1/1
100% Lines 3/3

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        72x   395x                                           72x      
import * as React from "react";
import { cn } from "@/utils";
import { TextareaProps } from "shared-types";
 
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
  ({ className, ...props }, ref) => {
    const strLn = (typeof props?.value === "string" && props.value.length) || 0;
    return (
      <>
        <textarea
          className={cn(
            "flex min-h-[76px] w-full rounded-sm border border-black bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
            className,
          )}
          ref={ref}
          {...props}
        />
        {props.charCount && (
          <p
            className={cn("text-right text-gray-500 pr-2 text-sm", props.charCountClassName)}
          >{`${strLn}${
            props.maxLength && props.charCount === "limited" ? `/${props.maxLength}` : ""
          }`}</p>
        )}
      </>
    );
  },
);
Textarea.displayName = "Textarea";
 
export { Textarea };