+11
-13
@@ -1,4 +1,4 @@
|
|||||||
import { type FC, type InputHTMLAttributes } from 'react'
|
import { type FC, type TextareaHTMLAttributes } from 'react'
|
||||||
import Error from './Error'
|
import Error from './Error'
|
||||||
import { clx } from '../helpers/utils'
|
import { clx } from '../helpers/utils'
|
||||||
|
|
||||||
@@ -6,34 +6,32 @@ type Props = {
|
|||||||
label?: string,
|
label?: string,
|
||||||
error_text?: string
|
error_text?: string
|
||||||
isNotRequired?: boolean
|
isNotRequired?: boolean
|
||||||
} & InputHTMLAttributes<HTMLTextAreaElement>
|
} & TextareaHTMLAttributes<HTMLTextAreaElement>
|
||||||
|
|
||||||
const Textarea: FC<Props> = (props: Props) => {
|
const Textarea: FC<Props> = ({ label, error_text, isNotRequired, className, ...textareaProps }) => {
|
||||||
return (
|
return (
|
||||||
<div className='w-full relative'>
|
<div className='w-full relative'>
|
||||||
{
|
{
|
||||||
props.label &&
|
label &&
|
||||||
<div className='flex items-center gap-1'>
|
<div className='flex items-center gap-1'>
|
||||||
<div className='text-sm'>{props.label}</div>
|
<div className='text-sm'>{label}</div>
|
||||||
{props.isNotRequired && (
|
{isNotRequired && (
|
||||||
<span className='text-xs text-description'>(اختیاری)</span>
|
<span className='text-xs text-description'>(اختیاری)</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
<textarea
|
<textarea
|
||||||
{...props}
|
{...textareaProps}
|
||||||
className={clx(
|
className={clx(
|
||||||
'border border-border leading-7 w-full rounded-xl px-4 py-3 min-h-[100px] mt-1 text-xs',
|
'border border-border leading-7 w-full rounded-xl px-4 py-3 min-h-[100px] mt-1 text-xs',
|
||||||
props.className
|
className
|
||||||
)}
|
)}
|
||||||
>
|
/>
|
||||||
|
|
||||||
</textarea>
|
|
||||||
|
|
||||||
{
|
{
|
||||||
props.error_text &&
|
error_text &&
|
||||||
<Error errorText={props.error_text} />
|
<Error errorText={error_text} />
|
||||||
}
|
}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user