diff options
author | muhamedsalih-tw <104364298+muhamedsalih-tw@users.noreply.github.com> | 2022-10-31 05:20:17 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-30 23:50:17 +0000 |
commit | 011e73f24f8ae15091d41781c93c313d0167d887 (patch) | |
tree | 3e012f97a9c3ecf98e348690f82dae0d58ec0155 /src/components/ui/input | |
parent | 6.2.1-nightly.33 [skip ci] (diff) | |
download | ferdium-app-011e73f24f8ae15091d41781c93c313d0167d887.tar.gz ferdium-app-011e73f24f8ae15091d41781c93c313d0167d887.tar.zst ferdium-app-011e73f24f8ae15091d41781c93c313d0167d887.zip |
Convert LoginScreen component tree to typescript (#721)
Diffstat (limited to 'src/components/ui/input')
-rw-r--r-- | src/components/ui/input/index.tsx | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/components/ui/input/index.tsx b/src/components/ui/input/index.tsx index 3bafc93e7..2a36d7aa9 100644 --- a/src/components/ui/input/index.tsx +++ b/src/components/ui/input/index.tsx | |||
@@ -1,7 +1,13 @@ | |||
1 | import { mdiEye, mdiEyeOff } from '@mdi/js'; | 1 | import { mdiEye, mdiEyeOff } from '@mdi/js'; |
2 | import Icon from '@mdi/react'; | 2 | import Icon from '@mdi/react'; |
3 | import classnames from 'classnames'; | 3 | import classnames from 'classnames'; |
4 | import { Component, createRef, InputHTMLAttributes } from 'react'; | 4 | import { |
5 | Component, | ||
6 | createRef, | ||
7 | InputHTMLAttributes, | ||
8 | ReactElement, | ||
9 | RefObject, | ||
10 | } from 'react'; | ||
5 | import injectSheet, { WithStylesProps } from 'react-jss'; | 11 | import injectSheet, { WithStylesProps } from 'react-jss'; |
6 | import { noop } from 'lodash'; | 12 | import { noop } from 'lodash'; |
7 | import { IFormField } from '../typings/generic'; | 13 | import { IFormField } from '../typings/generic'; |
@@ -26,7 +32,7 @@ interface IProps | |||
26 | showPasswordToggle?: boolean; | 32 | showPasswordToggle?: boolean; |
27 | data?: IData; | 33 | data?: IData; |
28 | inputClassName?: string; | 34 | inputClassName?: string; |
29 | onEnterKey?: Function; | 35 | onEnterKey?: () => {}; |
30 | } | 36 | } |
31 | 37 | ||
32 | interface IState { | 38 | interface IState { |
@@ -35,7 +41,7 @@ interface IState { | |||
35 | } | 41 | } |
36 | 42 | ||
37 | class InputComponent extends Component<IProps, IState> { | 43 | class InputComponent extends Component<IProps, IState> { |
38 | private inputRef = createRef<HTMLInputElement>(); | 44 | private inputRef: RefObject<HTMLInputElement> = createRef<HTMLInputElement>(); |
39 | 45 | ||
40 | constructor(props: IProps) { | 46 | constructor(props: IProps) { |
41 | super(props); | 47 | super(props); |
@@ -73,14 +79,14 @@ class InputComponent extends Component<IProps, IState> { | |||
73 | } | 79 | } |
74 | } | 80 | } |
75 | 81 | ||
76 | onInputKeyPress(e: React.KeyboardEvent) { | 82 | onInputKeyPress(e: React.KeyboardEvent): void { |
77 | if (e.key === 'Enter') { | 83 | if (e.key === 'Enter') { |
78 | const { onEnterKey } = this.props; | 84 | const { onEnterKey } = this.props; |
79 | onEnterKey && onEnterKey(); | 85 | onEnterKey && onEnterKey(); |
80 | } | 86 | } |
81 | } | 87 | } |
82 | 88 | ||
83 | render() { | 89 | render(): ReactElement { |
84 | const { | 90 | const { |
85 | classes, | 91 | classes, |
86 | className, | 92 | className, |