import React from 'react'
import PropTypes from 'prop-types'
import RTCheckBox from 'react-toolbox/lib/checkbox'
import theme from './theme.scss'

class CheckBox extends React.Component {
  render () {
    let className = ''
    let props = {...this.props}
    if (props.primary) {
      className += theme.primary
      delete props.primary
    }
    if (props.accent || props.secondary) {
      className += theme.accent
      delete props.accent
      delete props.secondary
    }
    if (props.className) {
      className += ' ' + this.props.className
      delete props.className
    }
    return (
      <RTCheckBox theme={theme} {...props} className={className}>
        {this.props.children}
      </RTCheckBox>
    )
  }
}

CheckBox.propTypes = {
  children: PropTypes.any
}

export default CheckBox
