import React from 'react'
import PropTypes from 'prop-types'
import RTInput from 'react-toolbox/lib/input'
import theme from './theme.scss'

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

Input.propTypes = {
  children: PropTypes.any
}

export default Input
