import React from 'react'
import PropTypes from 'prop-types'
import RTSwitch from 'react-toolbox/lib/switch'
import theme from './theme.scss'

class Switch extends React.Component {
  render () {
    let props = {...this.props}
    let className = props.className ? props.className : ''
    if (props.menuButton) {
      className += ' ' + theme.menuButton
      delete props.menuButton
    }
    if (props.accent || props.secondary) {
      className += ' ' + theme.accent
      delete props.accent
      delete props.secondary
    }
    return (
      <RTSwitch theme={theme} {...props} className={className}>
        {this.props.children}
      </RTSwitch>
    )
  }
}

Switch.propTypes = {
  children: PropTypes.any
}

export default Switch
