mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
refactored react imports
This commit is contained in:
parent
a9a220273f
commit
7a7b7a4bf9
253 changed files with 679 additions and 479 deletions
|
@ -1,4 +1,4 @@
|
|||
import React, {
|
||||
import {
|
||||
ButtonHTMLAttributes,
|
||||
DetailedHTMLProps,
|
||||
FC,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, { HTMLAttributes } from 'react';
|
||||
import { HTMLAttributes } from 'react';
|
||||
|
||||
import classNames from 'classnames';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, { FC, ReactNode } from 'react';
|
||||
import { FC, ReactNode } from 'react';
|
||||
|
||||
import classNames from 'classnames';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, {
|
||||
import {
|
||||
ChangeEvent,
|
||||
DetailedHTMLProps,
|
||||
FC,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, { FC } from 'react';
|
||||
import { FC } from 'react';
|
||||
|
||||
import classNames from 'classnames';
|
||||
|
||||
|
@ -11,7 +11,13 @@ interface InputWrapperProps {
|
|||
notEmpty: boolean;
|
||||
}
|
||||
|
||||
const InputWrapper: FC<InputWrapperProps> = ({ children, notEmpty, title, focused, error }) => (
|
||||
const InputWrapper: FC<InputWrapperProps> = ({
|
||||
children,
|
||||
notEmpty,
|
||||
title,
|
||||
focused,
|
||||
error,
|
||||
}) => (
|
||||
<div
|
||||
className={classNames(styles.content, {
|
||||
[styles.has_error]: !!error,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, { FC } from 'react';
|
||||
import { FC } from 'react';
|
||||
|
||||
import { Button } from '~/components/input/Button';
|
||||
|
||||
|
@ -10,9 +10,15 @@ interface LoadMoreButtonProps {
|
|||
}
|
||||
|
||||
const LoadMoreButton: FC<LoadMoreButtonProps> = ({ isLoading, onClick }) => (
|
||||
<Button color="flat" onClick={onClick} stretchy className={styles.more} loading={isLoading}>
|
||||
<Button
|
||||
color="flat"
|
||||
onClick={onClick}
|
||||
stretchy
|
||||
className={styles.more}
|
||||
loading={isLoading}
|
||||
>
|
||||
Показать ещё комментарии
|
||||
</Button>
|
||||
);
|
||||
|
||||
export { LoadMoreButton }
|
||||
export { LoadMoreButton };
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, { VFC } from 'react';
|
||||
import { VFC } from 'react';
|
||||
|
||||
import { Icon } from '~/components/common/Icon';
|
||||
import { InputText, InputTextProps } from '~/components/input/InputText';
|
||||
|
|
|
@ -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 };
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, { FC, useCallback } from 'react';
|
||||
import { FC, useCallback } from 'react';
|
||||
|
||||
import classNames from 'classnames';
|
||||
|
||||
|
@ -31,7 +31,7 @@ const Toggle: FC<IProps> = ({ value, handler, color = 'primary', ...rest }) => {
|
|||
styles.toggle,
|
||||
{ [styles.active]: value },
|
||||
styles[color],
|
||||
rest.className
|
||||
rest.className,
|
||||
)}
|
||||
onClick={onClick}
|
||||
/>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue