mirror of
https://github.com/strapi/strapi.git
synced 2025-08-13 11:17:42 +00:00
Merge pull request #1276 from johannpinson/patch-content-manager
Improve <Ico> component for handle click if specified
This commit is contained in:
commit
033127105d
@ -16,15 +16,20 @@ function Ico(props) {
|
||||
}
|
||||
|
||||
const handleClick = (e, onClick) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
onClick(e);
|
||||
if (onClick) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
onClick(e);
|
||||
}
|
||||
};
|
||||
|
||||
Ico.propTypes = {
|
||||
icoType: PropTypes.string,
|
||||
id: PropTypes.string,
|
||||
onClick: PropTypes.func,
|
||||
onClick: PropTypes.oneOfType([
|
||||
PropTypes.func,
|
||||
PropTypes.bool,
|
||||
]),
|
||||
};
|
||||
|
||||
Ico.defaultProps = {
|
||||
|
@ -82,7 +82,7 @@ class TableRow extends React.Component {
|
||||
|
||||
cells.push(
|
||||
<td key='action' className={styles.actions}>
|
||||
<IcoContainer icons={[{ icoType: 'pencil' }, { id: this.props.record.id, icoType: 'trash', onClick: this.props.onDelete }]} />
|
||||
<IcoContainer icons={[{ icoType: 'pencil', onClick: false }, { id: this.props.record.id, icoType: 'trash', onClick: this.props.onDelete }]} />
|
||||
</td>
|
||||
);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user