2017-04-17 17:14:17 +03:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2016-05-22 20:08:47 +03:00
|
|
|
import { themr } from 'react-css-themr';
|
2017-01-26 20:05:32 +03:00
|
|
|
import { LIST } from '../identifiers';
|
2016-01-27 13:21:03 +03:00
|
|
|
|
2017-01-26 20:05:32 +03:00
|
|
|
const ListItemAction = ({ action, theme }) => {
|
|
|
|
const { onClick, onMouseDown } = action.props;
|
2016-01-27 13:21:03 +03:00
|
|
|
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 = {
|
2017-01-26 20:05:32 +03:00
|
|
|
action: PropTypes.node,
|
2016-05-22 20:08:47 +03:00
|
|
|
theme: PropTypes.shape({
|
2017-01-26 20:05:32 +03:00
|
|
|
itemAction: PropTypes.string,
|
|
|
|
}),
|
2016-01-27 13:21:03 +03:00
|
|
|
};
|
|
|
|
|
2016-05-29 21:59:54 +03:00
|
|
|
export default themr(LIST)(ListItemAction);
|
|
|
|
export { ListItemAction };
|