Skip to content

Commit

Permalink
fix(image-card): render as div if no href is provided (#515)
Browse files Browse the repository at this point in the history
* fix(image-card): render as div if no href is provided

* fix(image-card): adjust logic for checking undefined href
  • Loading branch information
jendowns authored and jnm2377 committed Nov 13, 2019
1 parent 19b5e70 commit cb3769b
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -160,7 +159,7 @@ export default class ImageCard extends React.Component {
);

let cardContainer;
if (disabled === true) {
if (disabled === true || href === undefined) {
cardContainer = <div className={carbonTileclassNames}>{cardContent}</div>;
} else if (isLink === true) {
cardContainer = (
Expand Down

1 comment on commit cb3769b

@vercel
Copy link

@vercel vercel bot commented on cb3769b Nov 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.