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) => {
|
const handleClick = (e, onClick) => {
|
||||||
e.preventDefault();
|
if (onClick) {
|
||||||
e.stopPropagation();
|
e.preventDefault();
|
||||||
onClick(e);
|
e.stopPropagation();
|
||||||
|
onClick(e);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Ico.propTypes = {
|
Ico.propTypes = {
|
||||||
icoType: PropTypes.string,
|
icoType: PropTypes.string,
|
||||||
id: PropTypes.string,
|
id: PropTypes.string,
|
||||||
onClick: PropTypes.func,
|
onClick: PropTypes.oneOfType([
|
||||||
|
PropTypes.func,
|
||||||
|
PropTypes.bool,
|
||||||
|
]),
|
||||||
};
|
};
|
||||||
|
|
||||||
Ico.defaultProps = {
|
Ico.defaultProps = {
|
||||||
|
@ -82,7 +82,7 @@ class TableRow extends React.Component {
|
|||||||
|
|
||||||
cells.push(
|
cells.push(
|
||||||
<td key='action' className={styles.actions}>
|
<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>
|
</td>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user