Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(image-card): render as div if no href is provided #515

Merged
merged 3 commits into from
Nov 13, 2019
Merged

fix(image-card): render as div if no href is provided #515

merged 3 commits into from
Nov 13, 2019

Conversation

jendowns
Copy link
Contributor

@jendowns jendowns commented Nov 11, 2019

Closes #514

Currently unless you add the disabled prop, an ImageCard will always render as an anchor.
This is problematic if you don't also provide an href (which is not a required prop, either).

Recently on the IBM Security design team, we've come across a situation where we want the positioning and styling of an ImageCard within a grid, but we don't need to link it anywhere. (So, we aren't providing an href). The ImageGalleryCard would not apply well for our designs/situation., and we also don't want to apply disabled={true} to ImageCard which would apply "do not click" cursor + icon + give an impression that the Card would be clickable under other circumstances. So we wanted to propose a fix here.

Please let me know what you think -- thanks!

Changelog

Changed

  • only apply bx--tile--clickable class if href === undefined (for hover effects on links only, etc)
  • render ImageCard as a div if href === undefined

@vercel
Copy link

vercel bot commented Nov 11, 2019

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/carbon-design-system/gatsby-theme-carbon/3rbhthz19
🌍 Preview: https://gatsby-theme-carbon-git-fork-jendowns-514image-card.carbon-design-system.now.sh

@SimonFinney
Copy link

For context, we're currently migrating our experience guide over to use gatsby-theme-carbon under the hood - we'd like to reuse as much as possible and have several instances in which we use ImageCard with no link out to somewhere else.

As a workaround, we thought we could linking directly to the static image but this doesn't play good with Gatsby.

@alisonjoseph alisonjoseph requested a review from a team November 13, 2019 14:07
@ghost ghost requested review from dakahn and joshblack and removed request for a team November 13, 2019 14:07
Copy link
Member

@alisonjoseph alisonjoseph left a comment

Choose a reason for hiding this comment

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

👍 thanks for adding this!

@alisonjoseph alisonjoseph requested review from jnm2377 and removed request for dakahn and joshblack November 13, 2019 14:08
@jnm2377 jnm2377 merged commit cb3769b into carbon-design-system:master Nov 13, 2019
@jendowns jendowns deleted the 514_image-card branch November 13, 2019 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ImageCard] when no href prop provided, the ImageCard renders an anchor without a href
4 participants