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 }
|