import React from 'react';
import { InputGroup } from 'react-bootstrap';
import style from './index.module.scss';

interface TextareaProps
  extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
  iconLeft?: React.ReactNode;
  iconRight?: React.ReactNode;
}

const Textarea = ({ iconLeft, iconRight, ...props }: TextareaProps) => {
  return (
    <InputGroup className={`${style.input}`}>
      {iconLeft && (
        <InputGroup.Text className={`${style.inputIconLeft}`}>
          {iconLeft}
        </InputGroup.Text>
      )}
      <textarea className={`${style.inputField} form-control`} {...props} />
    </InputGroup>
  );
};

export default Textarea;
