diff options
author | Balaji Vijayakumar <kuttibalaji.v6@gmail.com> | 2022-10-26 18:49:54 +0530 |
---|---|---|
committer | Vijay Aravamudhan <vraravam@users.noreply.github.com> | 2022-10-26 19:26:39 +0530 |
commit | 47af2abe2c7dfa1b18494092278cbfb0a54f5db5 (patch) | |
tree | 6866f6744456bbc7146aa6120cbf5022976a9b1f /src/components/ui | |
parent | Upgrade 'macos-notification-state' to git SHA from fork '0a168f5b1f94c1fd3c08... (diff) | |
download | ferdium-app-47af2abe2c7dfa1b18494092278cbfb0a54f5db5.tar.gz ferdium-app-47af2abe2c7dfa1b18494092278cbfb0a54f5db5.tar.zst ferdium-app-47af2abe2c7dfa1b18494092278cbfb0a54f5db5.zip |
refactor: convert AccountDashboard to typescript
Diffstat (limited to 'src/components/ui')
-rw-r--r-- | src/components/ui/Loader.tsx | 23 | ||||
-rw-r--r-- | src/components/ui/infobox/index.tsx | 8 |
2 files changed, 17 insertions, 14 deletions
diff --git a/src/components/ui/Loader.tsx b/src/components/ui/Loader.tsx index 67c9db22e..ae51f8145 100644 --- a/src/components/ui/Loader.tsx +++ b/src/components/ui/Loader.tsx | |||
@@ -1,19 +1,20 @@ | |||
1 | import { Component, ReactChildren } from 'react'; | 1 | import {Component, PropsWithChildren} from 'react'; |
2 | import { observer, inject } from 'mobx-react'; | 2 | import { observer, inject } from 'mobx-react'; |
3 | import Loader from 'react-loader'; | 3 | import Loader from 'react-loader'; |
4 | 4 | ||
5 | import { FerdiumStores } from '../../@types/stores.types'; | 5 | import { FerdiumStores } from '../../@types/stores.types'; |
6 | 6 | ||
7 | type Props = { | 7 | interface IProps { |
8 | children: ReactChildren; | 8 | className?: string; |
9 | loaded: boolean; | 9 | color?: string; |
10 | className: string; | 10 | loaded?: boolean; |
11 | color: string; | 11 | stores?: FerdiumStores; |
12 | stores: FerdiumStores; | 12 | } |
13 | }; | ||
14 | 13 | ||
15 | // Can this file be merged into the './loader/index.tsx' file? | 14 | // Can this file be merged into the './loader/index.tsx' file? |
16 | class LoaderComponent extends Component<Props> { | 15 | @inject("stores") |
16 | @observer | ||
17 | class LoaderComponent extends Component<PropsWithChildren<IProps>> { | ||
17 | static defaultProps = { | 18 | static defaultProps = { |
18 | loaded: false, | 19 | loaded: false, |
19 | color: 'ACCENT', | 20 | color: 'ACCENT', |
@@ -25,7 +26,7 @@ class LoaderComponent extends Component<Props> { | |||
25 | const color = | 26 | const color = |
26 | this.props.color !== 'ACCENT' | 27 | this.props.color !== 'ACCENT' |
27 | ? this.props.color | 28 | ? this.props.color |
28 | : this.props.stores.settings.app.accentColor; | 29 | : this.props.stores!.settings.app.accentColor; |
29 | 30 | ||
30 | return ( | 31 | return ( |
31 | <Loader | 32 | <Loader |
@@ -42,4 +43,4 @@ class LoaderComponent extends Component<Props> { | |||
42 | } | 43 | } |
43 | } | 44 | } |
44 | 45 | ||
45 | export default inject('stores')(observer(LoaderComponent)); | 46 | export default LoaderComponent; |
diff --git a/src/components/ui/infobox/index.tsx b/src/components/ui/infobox/index.tsx index d1d7ef6cd..ad59ea81e 100644 --- a/src/components/ui/infobox/index.tsx +++ b/src/components/ui/infobox/index.tsx | |||
@@ -7,15 +7,16 @@ import { Theme } from '../../../themes'; | |||
7 | import Icon from '../icon'; | 7 | import Icon from '../icon'; |
8 | 8 | ||
9 | interface IProps extends WithStylesProps<typeof styles> { | 9 | interface IProps extends WithStylesProps<typeof styles> { |
10 | children: ReactNode; | ||
10 | icon?: string; | 11 | icon?: string; |
11 | type?: string; | 12 | type?: string; |
12 | dismissable?: boolean; | 13 | dismissable?: boolean; |
14 | ctaLabel?: string; | ||
15 | |||
16 | className?: string; | ||
13 | onDismiss?: () => void; | 17 | onDismiss?: () => void; |
14 | onUnmount?: () => void; | 18 | onUnmount?: () => void; |
15 | ctaOnClick?: () => void; | 19 | ctaOnClick?: () => void; |
16 | ctaLabel?: string; | ||
17 | children: ReactNode; | ||
18 | className: string; | ||
19 | } | 20 | } |
20 | 21 | ||
21 | interface IState { | 22 | interface IState { |
@@ -114,6 +115,7 @@ class InfoboxComponent extends Component<IProps, IState> { | |||
114 | ctaOnClick: () => {}, | 115 | ctaOnClick: () => {}, |
115 | onDismiss: () => {}, | 116 | onDismiss: () => {}, |
116 | ctaLabel: '', | 117 | ctaLabel: '', |
118 | className: '', | ||
117 | }; | 119 | }; |
118 | 120 | ||
119 | state = { | 121 | state = { |