Skip to content

Commit

Permalink
chore(card): style updates, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
asudoh committed Dec 29, 2020
1 parent ae3b722 commit 3e39d21
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,18 @@
}

.#{$prefix}--feature-card-block-medium__heading,
::slotted(#{$dds-prefix}-feature-card-block-medium-heading) {
::slotted(#{$dds-prefix}-card-heading) {
@include carbon--type-style('expressive-heading-04', true);

display: block;
margin-bottom: $carbon--spacing-07;
}

::slotted(#{$dds-prefix}-card-heading) {
width: auto;
max-width: none;
}

&:focus {
outline: none;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
outline-offset: 2px;
}

.#{$prefix}--card__heading {
.#{$prefix}--card__heading,
::slotted(#{$dds-prefix}-card-heading) {
margin-bottom: $layout-03;
}
}
Expand Down
10 changes: 10 additions & 0 deletions packages/web-components/src/components/card/card-heading.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ class DDSCardHeading extends LitElement {
@property({ reflect: true })
slot = 'heading';

connectedCallback() {
if (!this.hasAttribute('role')) {
this.setAttribute('role', 'heading');
}
if (!this.hasAttribute('aria-level')) {
this.setAttribute('aria-level', '3');
}
super.connectedCallback();
}

render() {
return html`
<slot></slot>
Expand Down
4 changes: 2 additions & 2 deletions packages/web-components/src/components/card/card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
.#{$prefix}--card__pictogram {
display: flex;

.#{$prefix}--card__heading {
::slotted(#{$dds-prefix}-card-heading) {
margin-bottom: 0;
flex: 1;
display: flex;
Expand All @@ -44,7 +44,7 @@

&[pictogram-placement='bottom'] {
.#{$prefix}--card__pictogram {
.#{$prefix}--card__heading {
::slotted(#{$dds-prefix}-card-heading) {
align-items: flex-start;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ const StoryContent = () => html`
srcset="https://fpoimg.com/600x600?text=1:1&amp;bg_color=ee5396&amp;text_color=161616"
>
</dds-image>
<span slot="eyebrow">scelerisque purus</span>
<span slot="heading">Elementum nibh tellus molestie nunc?</span>
<dds-card-eyebrow>scelerisque purus</dds-card-eyebrow>
<dds-card-heading>Elementum nibh tellus molestie nunc?</dds-card-heading>
<p>Habitant morbi tristique senectus et netus et malesuada fames. Habitant morbu tristique.</p>
<dds-feature-card-block-large-footer>
${ArrowRight20({ slot: 'icon' })}
Expand Down

0 comments on commit 3e39d21

Please sign in to comment.