1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

refactored react imports

This commit is contained in:
Fedor Katurov 2023-11-20 22:35:07 +06:00
parent a9a220273f
commit 7a7b7a4bf9
253 changed files with 679 additions and 479 deletions

View file

@ -1,11 +1,11 @@
import React, {
import {
ChangeEvent,
DetailedHTMLProps,
forwardRef,
TextareaHTMLAttributes,
useCallback,
useEffect,
useState
useState,
} from 'react';
import autosize from 'autosize';
@ -42,14 +42,14 @@ const Textarea = forwardRef<HTMLTextAreaElement, IProps>(
value,
...props
},
forwardRef
forwardRef,
) => {
const ref = useForwardRef(forwardRef);
const [focused, setFocused] = useState(false);
const onInput = useCallback(
({ target }: ChangeEvent<HTMLTextAreaElement>) => handler(target.value),
[handler]
[handler],
);
const onFocus = useCallback(() => setFocused(true), [setFocused]);
@ -68,7 +68,12 @@ const Textarea = forwardRef<HTMLTextAreaElement, IProps>(
}, [ref, value, forwardRef]);
return (
<InputWrapper title={title} error={error} focused={focused} notEmpty={!!value}>
<InputWrapper
title={title}
error={error}
focused={focused}
notEmpty={!!value}
>
<textarea
{...props}
ref={ref}
@ -85,7 +90,7 @@ const Textarea = forwardRef<HTMLTextAreaElement, IProps>(
/>
</InputWrapper>
);
}
},
);
export { Textarea };