import React from "react";
import { InputProps } from "antd";
import {
  CustomInput,
  ErrorText,
  InputContainer,
  SmallLabelTitle,
  LabelTitle,
} from "./AntInputStyles";

export interface AntInputProps extends InputProps {
  errorText?: string;
  labelText?: string;
  labelSize?: "small" | "large";
}
export const Input: React.FC<AntInputProps> = (props) => {
  const { status, errorText, labelText, labelSize } = props;
  return (
    <InputContainer>
      {labelSize === "small" ? (
        <SmallLabelTitle>{labelText}</SmallLabelTitle>
      ) : (
        <LabelTitle>{labelText}</LabelTitle>
      )}
      <CustomInput {...props} />
      {status == "error" ? <ErrorText>{errorText}</ErrorText> : null}
    </InputContainer>
  );
};
