From 6ddafb4fe32ae22db4dbecabd272521ef560f88f Mon Sep 17 00:00:00 2001 From: Johann Pinson Date: Thu, 24 May 2018 16:04:00 +0200 Subject: [PATCH 1/2] fix(admin): handle click if specified #1257 --- .../strapi-helper-plugin/lib/src/components/Ico/index.js | 8 +++++--- .../admin/src/components/TableRow/index.js | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/strapi-helper-plugin/lib/src/components/Ico/index.js b/packages/strapi-helper-plugin/lib/src/components/Ico/index.js index 367d2f65f1..875d288ba6 100644 --- a/packages/strapi-helper-plugin/lib/src/components/Ico/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/Ico/index.js @@ -16,9 +16,11 @@ function Ico(props) { } const handleClick = (e, onClick) => { - e.preventDefault(); - e.stopPropagation(); - onClick(e); + if (onClick) { + e.preventDefault(); + e.stopPropagation(); + onClick(e); + } }; Ico.propTypes = { diff --git a/packages/strapi-plugin-content-manager/admin/src/components/TableRow/index.js b/packages/strapi-plugin-content-manager/admin/src/components/TableRow/index.js index 0191fa0575..18c28a75db 100755 --- a/packages/strapi-plugin-content-manager/admin/src/components/TableRow/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/TableRow/index.js @@ -82,7 +82,7 @@ class TableRow extends React.Component { cells.push( - + ); From 28b2512484f74f64e8bba70d5e0a99f1a9862bd1 Mon Sep 17 00:00:00 2001 From: Johann Pinson Date: Mon, 28 May 2018 15:47:51 +0200 Subject: [PATCH 2/2] fix(admin): handle click if specified - update PropTypes --- .../strapi-helper-plugin/lib/src/components/Ico/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/strapi-helper-plugin/lib/src/components/Ico/index.js b/packages/strapi-helper-plugin/lib/src/components/Ico/index.js index 875d288ba6..a170196c03 100644 --- a/packages/strapi-helper-plugin/lib/src/components/Ico/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/Ico/index.js @@ -26,7 +26,10 @@ const handleClick = (e, onClick) => { Ico.propTypes = { icoType: PropTypes.string, id: PropTypes.string, - onClick: PropTypes.func, + onClick: PropTypes.oneOfType([ + PropTypes.func, + PropTypes.bool, + ]), }; Ico.defaultProps = {