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 | 1x 1x 1x | import React from 'react'; import PropTypes from 'prop-types'; const MenuItem = ({ title, onClick, styles, className, children }) => ( <div title={title || (typeof children === 'string' ? children : '')} className={`${styles.item} ${className}`} onClick={onClick} > { children } </div> ); MenuItem.propTypes = { onClick: PropTypes.func, styles: PropTypes.shape(), title: PropTypes.string }; MenuItem.defautProps = { onClick: undefined, styles: {}, title: '' }; export default MenuItem; |