Skip to content

Commit

Permalink
Merge 3e7bcc9 into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ibmdotcom-bot authored Dec 10, 2024
2 parents bb9ae8c + 3e7bcc9 commit ac3fe4f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
display: grid;
border: 0;
grid-row: span 10;
grid-template-columns: subgrid;
grid-template-rows: subgrid;
margin-block-end: $spacing-07;
outline: 1px solid $border-tile-01;
Expand Down
23 changes: 18 additions & 5 deletions packages/styles/scss/components/card/_card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
}
}

.#{$prefix}--card__copy:not([hidden]) {
.#{$prefix}--card__copy {
@include type-style('body-02');

margin-block-end: $spacing-07;
Expand Down Expand Up @@ -219,10 +219,6 @@

.#{$prefix}--card__copy {
margin-block: $spacing-07 0;

&[hidden] {
margin: 0;
}
}

svg {
Expand Down Expand Up @@ -254,6 +250,16 @@
align-items: flex-start;
}

.#{$prefix}--card__content {
padding-block-end: $spacing-10;
}

.#{$prefix}--card__pictogram-wrapper {
position: absolute;
inset-block-end: $spacing-05;
inset-inline-start: $spacing-05;
}

.#{$prefix}--card__copy {
margin-block-end: $spacing-07;
}
Expand Down Expand Up @@ -286,6 +292,13 @@
display: flex;
flex-direction: column;
gap: $spacing-05;

&[hidden] {
// Need important to force [hidden] to really mean hidden above many
// other variants setting display.
/* stylelint-disable declaration-no-important */
display: none !important;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,20 @@ const longHeadingCardGroupItem = (
`;
};

const pictogramCard = (colorScheme) => {
const pictogramCard = (colorScheme, hideDescription = false) => {
return html`
<c4d-card-group-item
href="https://example.com"
pictogram-placement="bottom"
color-scheme=${colorSchemeMap[colorScheme]}>
<c4d-card-heading>Aerospace and defence</c4d-card-heading>
<p>
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi
ut aliquip ex ea commodo consequat. Ut enim ad minim veniam, quis
nostrud exercitation.
</p>
${hideDescription
? ''
: html` <p>
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Ut enim ad minim veniam,
quis nostrud exercitation.
</p>`}
<svg
slot="pictogram"
focusable="false"
Expand Down Expand Up @@ -264,6 +266,7 @@ export const Default = (args) => {
cta,
addCta,
colorScheme,
hideDescription,
} = args?.CardGroup ?? {};

const allCards: object[] = [];
Expand Down Expand Up @@ -294,7 +297,7 @@ export const Default = (args) => {

if (cardType === 'Card - pictogram') {
for (let i = 0; i < cards; i++) {
allCards.push(pictogramCard(colorScheme));
allCards.push(pictogramCard(colorScheme, hideDescription));
}
}

Expand Down Expand Up @@ -460,6 +463,10 @@ export default {
['Regular', 'Inverse'],
'Regular'
);
const hideDescription =
cardType === 'Card - pictogram'
? boolean('Hide description', false)
: false;
return {
cardType,
media,
Expand All @@ -469,6 +476,7 @@ export default {
gridMode,
cta,
colorScheme,
hideDescription,
};
},
},
Expand Down

0 comments on commit ac3fe4f

Please sign in to comment.