react-toolbox/components/list/ListItemAction.js

26 lines
642 B
JavaScript

import React, { PropTypes } from 'react';
import { themr } from 'react-css-themr';
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: React.PropTypes.string.isRequired
})
};
ListItemAction.defaultProps = {
};
export default themr('ToolboxList')(ListItemAction);