UNPKG

react-toolbox-legacy

Version:

Unofficial fork of the react-toolbox package, compatible with React v16

26 lines (22 loc) 677 B
import React from 'react'; import PropTypes from 'prop-types'; import { themr } from 'react-css-themr-legacy'; import { LIST } from '../identifiers.js'; const ListItemAction = ({action, theme}) => { const {onClick, onMouseDown} = action.props; const stopRipple = onClick && !onMouseDown; const stop = e => e.stopPropagation(); return ( <span className={theme.itemAction} onMouseDown={stopRipple && stop} onClick={onClick && stop}> {action} </span> ); }; ListItemAction.propTypes = { action: PropTypes.object, theme: PropTypes.shape({ itemAction: PropTypes.string }) }; export default themr(LIST)(ListItemAction); export { ListItemAction };