meriadec
7 years ago
No known key found for this signature in database
GPG Key ID: 1D2FC2305E2CB399
2 changed files with
4 additions and
6 deletions
-
src/components/base/CheckBox/index.js
-
src/components/base/Radio/index.js
|
|
@ -1,7 +1,6 @@ |
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React from 'react' |
|
|
|
import noop from 'lodash/noop' |
|
|
|
import styled, { keyframes } from 'styled-components' |
|
|
|
|
|
|
|
import { Tabbable } from 'components/base/Box' |
|
|
@ -54,14 +53,14 @@ type Props = { |
|
|
|
function CheckBox(props: Props) { |
|
|
|
const { isChecked, onChange, ...p } = props |
|
|
|
return ( |
|
|
|
<Base isChecked={isChecked} onClick={() => onChange(!isChecked)} {...p}> |
|
|
|
<Base isChecked={isChecked} onClick={() => onChange && onChange(!isChecked)} {...p}> |
|
|
|
{isChecked && <IconWrapper name="check" />} |
|
|
|
</Base> |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
CheckBox.defaultProps = { |
|
|
|
onChange: noop, |
|
|
|
onChange: null, |
|
|
|
} |
|
|
|
|
|
|
|
export default CheckBox |
|
|
|
|
|
@ -1,7 +1,6 @@ |
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React from 'react' |
|
|
|
import noop from 'lodash/noop' |
|
|
|
import styled from 'styled-components' |
|
|
|
|
|
|
|
import { Tabbable } from 'components/base/Box' |
|
|
@ -63,11 +62,11 @@ type Props = { |
|
|
|
|
|
|
|
function Radio(props: Props) { |
|
|
|
const { isChecked, onChange } = props |
|
|
|
return <Base {...props} isChecked={isChecked} onClick={() => onChange(!isChecked)} /> |
|
|
|
return <Base {...props} isChecked={isChecked} onClick={() => onChange && onChange(!isChecked)} /> |
|
|
|
} |
|
|
|
|
|
|
|
Radio.defaultProps = { |
|
|
|
onChange: noop, |
|
|
|
onChange: null, |
|
|
|
} |
|
|
|
|
|
|
|
export default Radio |
|
|
|