From d53abb4ba808285cbe2a0ac646831a87ad65360b Mon Sep 17 00:00:00 2001 From: Josh Dover Date: Wed, 8 May 2019 13:22:41 -0500 Subject: [PATCH] Allow href and onClick in ListGroupItem --- .../list_group_item.test.js.snap | 34 ++++++++++--------- src/components/list_group/list_group_item.js | 6 +--- .../list_group/list_group_item.test.js | 21 +++++------- 3 files changed, 28 insertions(+), 33 deletions(-) diff --git a/src/components/list_group/__snapshots__/list_group_item.test.js.snap b/src/components/list_group/__snapshots__/list_group_item.test.js.snap index 26fc39e957d9..685a2976fa6f 100644 --- a/src/components/list_group/__snapshots__/list_group_item.test.js.snap +++ b/src/components/list_group/__snapshots__/list_group_item.test.js.snap @@ -146,6 +146,24 @@ exports[`EuiListGroupItem props isDisabled is rendered 1`] = ` `; +exports[`EuiListGroupItem props onClick and href is rendered 1`] = ` +
  • + + + Label + + +
  • +`; + exports[`EuiListGroupItem props onClick is rendered 1`] = `
  • `; - -exports[`EuiListGroupItem throws an warning if both onClick and href are provided but still renders 1`] = ` -
  • - - - -
  • -`; diff --git a/src/components/list_group/list_group_item.js b/src/components/list_group/list_group_item.js index 95444f5f776f..b3cf946f7eb9 100644 --- a/src/components/list_group/list_group_item.js +++ b/src/components/list_group/list_group_item.js @@ -92,15 +92,11 @@ export const EuiListGroupItem = ({ if (href && !isDisabled) { itemContent = ( - + {iconNode} {labelContent} ); - - if (onClick) { - console.warn('Both `href` and `onClick` were passed to EuiListGroupItem but only one can exist. The `href` was used.'); - } } else if ((href && isDisabled) || onClick) { itemContent = (