All files / components/dropdown/dropdown-item index.js

0% Statements 0/50
0% Branches 0/37
0% Functions 0/11
0% Lines 0/13
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32                                                               
import React, { Component } from 'react'
import PropTypes from 'prop-types'
 
import DropDownItemStyled from './dropdown-item.styled'
 
class DropDownItem extends Component {
  _onClick = (event) => {
    const { onClick } = this.props
    if (onClick) {
      onClick(event)
    }
  }
 
  render () {
    const { children, icon } = this.props
    return (
      <DropDownItemStyled onClick={this._onClick} >
        {icon && <span className="icon">{icon}</span>}
        <span className="text">{children}</span>
      </DropDownItemStyled>
    )
  }
}
 
DropDownItem.propTypes = {
  children: PropTypes.node.isRequired,
  onClick: PropTypes.func,
  icon: PropTypes.string
}
 
export { DropDownItem }