/**
 * Toast item component
 * @class ApToastItem
 */
'use strict'

import React, {PropTypes as types} from 'react'
import {shallowEqual} from 'asobj'
import classnames from 'classnames'
import {ApIcon} from 'apeman-react-icon'
import {withTouch} from 'apeman-react-touchable'

/** @lends ApToastItem */
const ApToastItem = React.createClass({
  // --------------------
  // Specs
  // --------------------

  propTypes: {
    text: types.string,
    icon: types.string
  },

  mixins: [],

  render () {
    const s = this
    let { props } = s
    return (
      <div className='ap-toast-item'>
        <span className='ap-toast-text'>
            <ApIcon className={ classnames('ap-toast-item-icon', props.icon) }/>{ props.text }
        </span>
      </div>
    )
  },

  // --------------------
  // Lifecycle
  // --------------------

  shouldComponentUpdate (nextProps, nextState) {
    const s = this
    let { props, state } = s
    return !shallowEqual(props, nextProps) || shallowEqual(state, nextState)
  }
})

export default ApToastItem // Dummy for doc
export default withTouch(ApToastItem)
