From a051331680b21f20201a47601d69505a4cfa9e40 Mon Sep 17 00:00:00 2001 From: muhamedsalih-tw <104364298+muhamedsalih-tw@users.noreply.github.com> Date: Sat, 19 Nov 2022 15:21:09 +0530 Subject: Transform service components to ts (#778) --- src/components/ui/FAB.tsx | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) (limited to 'src/components/ui') diff --git a/src/components/ui/FAB.tsx b/src/components/ui/FAB.tsx index 37c3c9ec7..acb0f690e 100644 --- a/src/components/ui/FAB.tsx +++ b/src/components/ui/FAB.tsx @@ -1,30 +1,28 @@ -/** - * Floating Action Button (FAB) - */ -import { Component, ReactChildren } from 'react'; +import { Component, ReactElement, ReactNode } from 'react'; import { observer } from 'mobx-react'; import classnames from 'classnames'; +import { noop } from 'lodash'; -type Props = { +interface IProps { className: string; - disabled: boolean; - onClick: () => void; - type: string; - children: ReactChildren; - htmlForm: string; -}; - -class Button extends Component { - static defaultProps = { - disabled: false, - onClick: () => {}, - type: 'button', - htmlForm: '', - }; + disabled?: boolean; + onClick?: () => void; + type?: string; + children: ReactNode; + htmlForm?: string; +} - render() { - const { className, disabled, onClick, type, children, htmlForm } = - this.props; +@observer +class Button extends Component { + render(): ReactElement { + const { + className, + disabled = false, + onClick = noop, + type = 'button', + children, + htmlForm = '', + } = this.props; const buttonProps = { className: classnames({ @@ -45,4 +43,4 @@ class Button extends Component { } } -export default observer(Button); +export default Button; -- cgit v1.2.3-54-g00ecf