bigbuffet-rw/app/soapbox/components/ui/textarea/textarea.tsx

31 lines
863 B
TypeScript
Raw Normal View History

2022-03-21 11:09:01 -07:00
import classNames from 'classnames';
import React from 'react';
2022-04-12 06:49:41 -07:00
interface ITextarea extends Pick<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'maxLength' | 'onChange' | 'required'> {
2022-03-21 11:09:01 -07:00
autoFocus?: boolean,
defaultValue?: string,
name?: string,
isCodeEditor?: boolean,
placeholder?: string,
value?: string,
autoComplete?: string,
2022-03-21 11:09:01 -07:00
}
const Textarea = React.forwardRef(
({ isCodeEditor = false, ...props }: ITextarea, ref: React.ForwardedRef<HTMLTextAreaElement>) => {
return (
<textarea
{...props}
ref={ref}
className={classNames({
2022-03-23 17:18:37 -07:00
'dark:bg-slate-800 shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 dark:border-gray-600 rounded-md':
2022-03-21 11:09:01 -07:00
true,
'font-mono': isCodeEditor,
})}
/>
);
},
);
export default Textarea;