From cb3769bec3877c35581907ae787d5a0900afd18b Mon Sep 17 00:00:00 2001 From: Jen Downs Date: Wed, 13 Nov 2019 11:12:35 -0600 Subject: [PATCH] fix(image-card): render as div if no href is provided (#515) * fix(image-card): render as div if no href is provided * fix(image-card): adjust logic for checking undefined href --- .../src/components/ImageCard/ImageCard.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/gatsby-theme-carbon/src/components/ImageCard/ImageCard.js b/packages/gatsby-theme-carbon/src/components/ImageCard/ImageCard.js index 2423c41f2..3f108a530 100755 --- a/packages/gatsby-theme-carbon/src/components/ImageCard/ImageCard.js +++ b/packages/gatsby-theme-carbon/src/components/ImageCard/ImageCard.js @@ -117,10 +117,9 @@ export default class ImageCard extends React.Component { [`${prefix}--aspect-ratio--4x3`]: aspectRatio === '4:3', }); - const carbonTileclassNames = classnames( - [`${prefix}--tile`], - [`${prefix}--tile--clickable`] - ); + const carbonTileclassNames = classnames([`${prefix}--tile`], { + [`${prefix}--tile--clickable`]: href !== undefined, + }); const titleClassNames = classnames([`${prefix}--image-card__title`], { [`${prefix}--image-card__title--dark`]: titleColor === 'dark', @@ -160,7 +159,7 @@ export default class ImageCard extends React.Component { ); let cardContainer; - if (disabled === true) { + if (disabled === true || href === undefined) { cardContainer =
{cardContent}
; } else if (isLink === true) { cardContainer = (