import { FC, InputHTMLAttributes } from 'react'
import Error from './Error'
import { clx } from '../helpers/utils'

type Props = {
    label?: string,
    error_text?: string
} & InputHTMLAttributes<HTMLTextAreaElement>

const Textarea: FC<Props> = (props: Props) => {
    return (
        <div className='w-full relative'>
            {
                props.label &&
                <div className='text-sm text-black' >
                    {props.label}
                </div>
            }

            <textarea
                {...props}
                className={clx(
                    'border border-[#D0D0D0] leading-7 w-full rounded-xl px-4 py-3 min-h-[100px] mt-1 text-xs',
                    props.className
                )}
            >

            </textarea>

            {
                props.error_text &&
                <Error errorText={props.error_text} />
            }

        </div>
    )
}

export default Textarea