feat: add forms logic
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
import s from './text-area.module.scss';
|
||||
import { DetailedHTMLProps, ReactNode, TextareaHTMLAttributes } from 'react';
|
||||
import {
|
||||
DetailedHTMLProps,
|
||||
forwardRef,
|
||||
ReactNode,
|
||||
Ref,
|
||||
TextareaHTMLAttributes,
|
||||
} from 'react';
|
||||
import { clsx } from 'clsx';
|
||||
|
||||
type TextAreaProps = {
|
||||
@@ -12,21 +18,27 @@ type TextAreaProps = {
|
||||
HTMLTextAreaElement
|
||||
>;
|
||||
|
||||
export default function TextArea({
|
||||
className,
|
||||
children,
|
||||
variant = 'default',
|
||||
fullWidth = false,
|
||||
...props
|
||||
}: TextAreaProps) {
|
||||
const TextArea = forwardRef(function TextArea(
|
||||
{
|
||||
className,
|
||||
children,
|
||||
variant = 'default',
|
||||
fullWidth = false,
|
||||
...props
|
||||
}: TextAreaProps,
|
||||
ref: Ref<HTMLTextAreaElement>,
|
||||
) {
|
||||
return (
|
||||
<div className={clsx(s.Container, fullWidth && s.Container_fullWidth)}>
|
||||
<textarea
|
||||
{...props}
|
||||
ref={ref}
|
||||
className={clsx(className, s.Area, s['Area_' + variant])}
|
||||
>
|
||||
{children}
|
||||
</textarea>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
export default TextArea;
|
||||
|
||||
Reference in New Issue
Block a user