feat: add forms logic

This commit is contained in:
2025-06-09 14:11:36 +03:00
parent 9b6e163da5
commit a17afb39ba
18 changed files with 481 additions and 84 deletions

View File

@@ -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;