mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
eslint fix
This commit is contained in:
parent
dfaac877fb
commit
fa4d51360b
81 changed files with 741 additions and 972 deletions
|
@ -5,7 +5,7 @@ import { describeArc } from '~/utils/dom';
|
|||
interface IProps {
|
||||
size: number;
|
||||
progress: number;
|
||||
};
|
||||
}
|
||||
|
||||
export const ArcProgress: FC<IProps> = ({ size, progress }) => (
|
||||
<svg className={styles.icon} width={size} height={size}>
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import classnames from "classnames";
|
||||
import * as styles from "./styles.scss";
|
||||
import React, { ButtonHTMLAttributes, DetailedHTMLProps, FC } from "react";
|
||||
import { Icon } from "~/components/input/Icon";
|
||||
import { IIcon } from "~/redux/types";
|
||||
import classnames from 'classnames';
|
||||
import React, { ButtonHTMLAttributes, DetailedHTMLProps, FC } from 'react';
|
||||
import * as styles from './styles.scss';
|
||||
import { Icon } from '~/components/input/Icon';
|
||||
import { IIcon } from '~/redux/types';
|
||||
|
||||
type IButtonProps = DetailedHTMLProps<
|
||||
ButtonHTMLAttributes<HTMLButtonElement>,
|
||||
HTMLButtonElement
|
||||
ButtonHTMLAttributes<HTMLButtonElement>,
|
||||
HTMLButtonElement
|
||||
> & {
|
||||
size?: "mini" | "normal" | "big" | "giant" | "micro";
|
||||
size?: 'mini' | 'normal' | 'big' | 'giant' | 'micro';
|
||||
iconLeft?: IIcon;
|
||||
iconRight?: IIcon;
|
||||
seamless?: boolean;
|
||||
|
@ -22,8 +22,8 @@ type IButtonProps = DetailedHTMLProps<
|
|||
};
|
||||
|
||||
export const Button: FC<IButtonProps> = ({
|
||||
className = "",
|
||||
size = "normal",
|
||||
className = '',
|
||||
size = 'normal',
|
||||
iconLeft,
|
||||
iconRight,
|
||||
children,
|
||||
|
@ -36,26 +36,25 @@ export const Button: FC<IButtonProps> = ({
|
|||
title,
|
||||
stretchy,
|
||||
...props
|
||||
}) =>
|
||||
React.createElement(seamless || non_submitting ? "div" : "button", {
|
||||
className: classnames(styles.button, className, styles[size], {
|
||||
red,
|
||||
grey,
|
||||
seamless,
|
||||
transparent,
|
||||
disabled: props.disabled,
|
||||
icon: (iconLeft || iconRight) && !title && !children,
|
||||
is_loading,
|
||||
stretchy
|
||||
}),
|
||||
children: [
|
||||
iconLeft && <Icon icon={iconLeft} size={20} key={0} />,
|
||||
title ? (
|
||||
<span key={1}>{title}</span>
|
||||
) : (
|
||||
(children && <span key={1}>{children}</span>) || null
|
||||
),
|
||||
iconRight && <Icon icon={iconRight} size={20} key={2} />
|
||||
],
|
||||
...props
|
||||
});
|
||||
}) => React.createElement(seamless || non_submitting ? 'div' : 'button', {
|
||||
className: classnames(styles.button, className, styles[size], {
|
||||
red,
|
||||
grey,
|
||||
seamless,
|
||||
transparent,
|
||||
disabled: props.disabled,
|
||||
icon: (iconLeft || iconRight) && !title && !children,
|
||||
is_loading,
|
||||
stretchy
|
||||
}),
|
||||
children: [
|
||||
iconLeft && <Icon icon={iconLeft} size={20} key={0} />,
|
||||
title ? (
|
||||
<span key={1}>{title}</span>
|
||||
) : (
|
||||
(children && <span key={1}>{children}</span>) || null
|
||||
),
|
||||
iconRight && <Icon icon={iconRight} size={20} key={2} />
|
||||
],
|
||||
...props
|
||||
});
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
import React, { FC } from "react";
|
||||
import { IIcon } from "~/redux/types";
|
||||
import React, { FC } from 'react';
|
||||
import { IIcon } from '~/redux/types';
|
||||
|
||||
type IProps = React.SVGAttributes<SVGElement> & {
|
||||
size?: number;
|
||||
icon: IIcon;
|
||||
};
|
||||
|
||||
export const Icon: FC<IProps> = ({ size = 20, icon, style, ...props }) => (
|
||||
export const Icon: FC<IProps> = ({
|
||||
size = 20, icon, style, ...props
|
||||
}) => (
|
||||
<svg
|
||||
width={size}
|
||||
height={size}
|
||||
viewBox={`0 0 24 24`}
|
||||
viewBox="0 0 24 24"
|
||||
preserveAspectRatio="xMidYMid slice"
|
||||
style={{ ...style, outline: "none" }}
|
||||
style={{ ...style, outline: 'none' }}
|
||||
{...props}
|
||||
>
|
||||
<use xlinkHref={`#${icon}`} />
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
import * as React from 'react';
|
||||
import classNames = require("classnames");
|
||||
|
||||
import classNames = require('classnames');
|
||||
|
||||
const style = require('./style.scss');
|
||||
|
||||
interface IInfoProps {
|
||||
text?: string,
|
||||
children?: string,
|
||||
level?: string,
|
||||
text?: string;
|
||||
children?: string;
|
||||
level?: string;
|
||||
}
|
||||
export const Info: React.FunctionComponent<IInfoProps> = ({
|
||||
text,
|
||||
|
|
|
@ -4,8 +4,8 @@ import React, {
|
|||
useCallback,
|
||||
useState, useEffect,
|
||||
} from 'react';
|
||||
import * as styles from '~/styles/inputs.scss';
|
||||
import classNames from 'classnames';
|
||||
import * as styles from '~/styles/inputs.scss';
|
||||
import { Icon } from '~/components/input/Icon';
|
||||
import { IInputTextProps } from '~/redux/types';
|
||||
import { LoaderCircle } from '~/components/input/LoaderCircle';
|
||||
|
@ -31,8 +31,8 @@ const InputText: FC<IInputTextProps> = ({
|
|||
[handler],
|
||||
);
|
||||
|
||||
const onFocus = useCallback(() => setFocused(true), [focused]);
|
||||
const onBlur = useCallback(() => setFocused(false), [focused]);
|
||||
const onFocus = useCallback(() => setFocused(true), []);
|
||||
const onBlur = useCallback(() => setFocused(false), []);
|
||||
|
||||
useEffect(() => {
|
||||
if (onRef) onRef(inner_ref);
|
||||
|
@ -50,7 +50,8 @@ const InputText: FC<IInputTextProps> = ({
|
|||
[styles.has_error]: !!error,
|
||||
[styles.has_loader]: is_loading,
|
||||
},
|
||||
)}>
|
||||
)}
|
||||
>
|
||||
<div className={styles.input}>
|
||||
<input
|
||||
type="text"
|
||||
|
|
|
@ -2,12 +2,12 @@ import * as React from 'react';
|
|||
import * as styles from './styles.scss';
|
||||
|
||||
interface ITextInputProps {
|
||||
type?: 'text' | 'password',
|
||||
placeholder?: string,
|
||||
label?: string,
|
||||
value?: string,
|
||||
type?: 'text' | 'password';
|
||||
placeholder?: string;
|
||||
label?: string;
|
||||
value?: string;
|
||||
|
||||
onChange: React.ChangeEventHandler,
|
||||
onChange: React.ChangeEventHandler;
|
||||
}
|
||||
|
||||
export const TextInput: React.FunctionComponent<ITextInputProps> = ({
|
||||
|
@ -15,15 +15,15 @@ export const TextInput: React.FunctionComponent<ITextInputProps> = ({
|
|||
placeholder = '',
|
||||
label,
|
||||
onChange = () => {},
|
||||
value='',
|
||||
value = '',
|
||||
}) => (
|
||||
<div
|
||||
className={styles.wrapper}
|
||||
>
|
||||
<div className={styles.container}>
|
||||
{
|
||||
label &&
|
||||
<div className={styles.label}>{label}</div>
|
||||
label
|
||||
&& <div className={styles.label}>{label}</div>
|
||||
}
|
||||
<input
|
||||
placeholder={placeholder}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue