import React from "react";
import { ErrorText, InputContainer, SmallLabelTitle, LabelTitle } from "../AntInputStyles";
import { CustomTextArea } from "./AntOpenTextStyles";
import { TextAreaProps } from "antd/es/input";

export interface AntTextAreaProps extends TextAreaProps {
  errorText?: string;
  labelText?: React.ReactNode;
  width?: string;
  labelSize?: "small" | "large";
}
export const OpenText: React.FC<AntTextAreaProps> = (props) => {
  const { status, errorText, labelText, labelSize } = props;
  return (
    <InputContainer>
      {labelSize === "small" ? (
        <SmallLabelTitle>{labelText}</SmallLabelTitle>
      ) : (
        <LabelTitle>{labelText}</LabelTitle>
      )}
      <CustomTextArea {...props} />
      {status == "error" ? <ErrorText>{errorText}</ErrorText> : null}
    </InputContainer>
  );
};
