Browse Source

fix flow

master
Gaëtan Renaudeau 7 years ago
committed by meriadec
parent
commit
126602dc9d
No known key found for this signature in database GPG Key ID: 1D2FC2305E2CB399
  1. 1
      src/components/CounterValue/stories.js
  2. 2
      src/components/SettingsPage/sections/Tools.js
  3. 4
      src/components/base/Button/index.js
  4. 41
      src/components/base/Modal/index.js
  5. 5
      src/logger.js

1
src/components/CounterValue/stories.js

@ -12,5 +12,6 @@ const stories = storiesOf('Components', module)
const currency = getCryptoCurrencyById('bitcoin')
stories.add('CounterValue', () => (
// $FlowFixMe
<CounterValue currency={currency} value={number('value', 100000000)} />
))

2
src/components/SettingsPage/sections/Tools.js

@ -20,7 +20,7 @@ class TabProfile extends PureComponent<*, *> {
this.setState({ qrcodeMobileExportModal: false })
}
renderQRCodeModal = ({ onClose }: *) => (
renderQRCodeModal = ({ onClose }: any) => (
<ModalBody onClose={onClose} justify="center" align="center">
<ModalTitle>{'QRCode Mobile Export'}</ModalTitle>
<ModalContent flow={4}>

4
src/components/base/Button/index.js

@ -11,7 +11,9 @@ import { focusedShadowStyle } from 'components/base/Box/Tabbable'
import Spinner from 'components/base/Spinner'
const buttonStyles = {
type Style = any // FIXME
const buttonStyles: { [_: string]: Style } = {
default: {
default: noop,
active: noop,

41
src/components/base/Modal/index.js

@ -28,11 +28,26 @@ const springConfig = {
stiffness: 320,
}
const mapStateToProps: Function = (
state,
{ name, isOpened, onBeforeOpen }: { name: string, isOpened?: boolean, onBeforeOpen: Function },
): * => {
const data = getModalData(state, name)
type OwnProps = {
name?: string, // eslint-disable-line
isOpened?: boolean,
onBeforeOpen?: ({ data: * }) => *, // eslint-disable-line
onClose?: () => void,
onHide?: () => void,
preventBackdropClick?: boolean,
render: Function,
refocusWhenChange?: string,
}
type Props = OwnProps & {
isOpened?: boolean,
data?: any,
} & {
onClose?: () => void,
}
const mapStateToProps = (state, { name, isOpened, onBeforeOpen }: OwnProps): * => {
const data = getModalData(state, name || '')
const modalOpened = isOpened || (name && isModalOpened(state, name))
if (onBeforeOpen && modalOpened) {
@ -40,12 +55,12 @@ const mapStateToProps: Function = (
}
return {
isOpened: modalOpened,
isOpened: !!modalOpened,
data,
}
}
const mapDispatchToProps: Function = (dispatch, { name, onClose = noop }): * => ({
const mapDispatchToProps = (dispatch: *, { name, onClose = noop }: OwnProps): * => ({
onClose: name
? () => {
dispatch(closeModal(name))
@ -104,21 +119,9 @@ class Pure extends Component<any> {
}
}
type Props = {
data?: any,
isOpened: boolean,
onClose?: Function,
onHide?: Function,
preventBackdropClick: boolean,
render: Function,
refocusWhenChange?: string,
}
export class Modal extends Component<Props> {
static defaultProps = {
data: undefined,
isOpened: false,
onClose: noop,
onHide: noop,
preventBackdropClick: false,
}

5
src/logger.js

@ -79,9 +79,10 @@ export default {
},
// tracks keyboard events
onTabKey: activeElement => {
onTabKey: (activeElement: ?HTMLElement) => {
if (!activeElement) return
const { classList, tagName } = activeElement
const displayEl = `${tagName.toLowerCase()}${classList.length ? ` ${classList[0]}` : ''}`
const displayEl = `${tagName.toLowerCase()}${classList.length ? ` ${classList.item(0)}` : ''}`
const msg = `⇓ <TAB> - active element ${displayEl}`
if (logTabkey) {
console.log(msg)

Loading…
Cancel
Save