Browse Source

Fix flow error

master
meriadec 7 years ago
parent
commit
bf977c4439
No known key found for this signature in database GPG Key ID: 1D2FC2305E2CB399
  1. 5
      src/components/base/CheckBox/index.js
  2. 5
      src/components/base/Radio/index.js

5
src/components/base/CheckBox/index.js

@ -1,7 +1,6 @@
// @flow // @flow
import React from 'react' import React from 'react'
import noop from 'lodash/noop'
import styled, { keyframes } from 'styled-components' import styled, { keyframes } from 'styled-components'
import { Tabbable } from 'components/base/Box' import { Tabbable } from 'components/base/Box'
@ -54,14 +53,14 @@ type Props = {
function CheckBox(props: Props) { function CheckBox(props: Props) {
const { isChecked, onChange, ...p } = props const { isChecked, onChange, ...p } = props
return ( return (
<Base isChecked={isChecked} onClick={() => onChange(!isChecked)} {...p}> <Base isChecked={isChecked} onClick={() => onChange && onChange(!isChecked)} {...p}>
{isChecked && <IconWrapper name="check" />} {isChecked && <IconWrapper name="check" />}
</Base> </Base>
) )
} }
CheckBox.defaultProps = { CheckBox.defaultProps = {
onChange: noop, onChange: null,
} }
export default CheckBox export default CheckBox

5
src/components/base/Radio/index.js

@ -1,7 +1,6 @@
// @flow // @flow
import React from 'react' import React from 'react'
import noop from 'lodash/noop'
import styled from 'styled-components' import styled from 'styled-components'
import { Tabbable } from 'components/base/Box' import { Tabbable } from 'components/base/Box'
@ -63,11 +62,11 @@ type Props = {
function Radio(props: Props) { function Radio(props: Props) {
const { isChecked, onChange } = props const { isChecked, onChange } = props
return <Base {...props} isChecked={isChecked} onClick={() => onChange(!isChecked)} /> return <Base {...props} isChecked={isChecked} onClick={() => onChange && onChange(!isChecked)} />
} }
Radio.defaultProps = { Radio.defaultProps = {
onChange: noop, onChange: null,
} }
export default Radio export default Radio

Loading…
Cancel
Save