2016-04-09 21:34:34 +03:00
|
|
|
import React, { PropTypes } from 'react';
|
2016-05-22 20:08:47 +03:00
|
|
|
import { themr } from 'react-css-themr';
|
2016-05-29 21:59:54 +03:00
|
|
|
import { LIST } from '../identifiers.js';
|
2016-01-27 13:21:03 +03:00
|
|
|
|
2016-05-22 20:08:47 +03:00
|
|
|
const ListItemAction = ({action, theme}) => {
|
2016-01-27 13:21:03 +03:00
|
|
|
const {onClick, onMouseDown} = action.props;
|
|
|
|
const stopRipple = onClick && !onMouseDown;
|
|
|
|
const stop = e => e.stopPropagation();
|
|
|
|
return (
|
2016-05-22 20:08:47 +03:00
|
|
|
<span className={theme.itemAction} onMouseDown={stopRipple && stop} onClick={onClick && stop}>
|
2016-01-27 13:21:03 +03:00
|
|
|
{action}
|
|
|
|
</span>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
ListItemAction.propTypes = {
|
2016-05-22 20:08:47 +03:00
|
|
|
action: PropTypes.object,
|
|
|
|
theme: PropTypes.shape({
|
2016-06-04 00:44:33 +03:00
|
|
|
itemAction: PropTypes.string
|
2016-05-22 20:08:47 +03:00
|
|
|
})
|
2016-01-27 13:21:03 +03:00
|
|
|
};
|
|
|
|
|
2016-05-29 21:59:54 +03:00
|
|
|
export default themr(LIST)(ListItemAction);
|
|
|
|
export { ListItemAction };
|