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(feature-card): don't provide FeatureCard's href to ResourceC… #518

Merged
merged 11 commits into from
Nov 19, 2019
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ export default class FeatureCard extends React.Component {
title={title}
subTitle={subTitle}
aspectRatio="2:1"
href={href}
actionIcon={actionIcon}
color={color}
disabled={disabled}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
.#{$prefix}--feature-card__img {
position: relative;
}

.#{$prefix}--feature-card:hover
.#{$prefix}--feature-card__link
.#{$prefix}--tile {
Expand All @@ -33,6 +34,14 @@
background: $carbon--gray-80; //$hover-ui for gray 90 theme
}

.#{$prefix}--feature-card__link:focus {
outline: none;

.gatsby-resp-image-wrapper {
@include focus-outline;
vpicone marked this conversation as resolved.
Show resolved Hide resolved
}
}

// Display image at square aspect ratio only on mobile
.#{$prefix}--feature-card__img.#{$prefix}--aspect-ratio--1x1 {
@include carbon--breakpoint('md') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,9 @@ export default class ResourceCard 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 cardContent = (
<>
Expand Down Expand Up @@ -127,7 +126,7 @@ export default class ResourceCard 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