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 b4b12ec
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 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

0 comments on commit b4b12ec

Please sign in to comment.