Skip to content

Commit

Permalink
feat(card): Add transparent outline to elevated card, so card boundar…
Browse files Browse the repository at this point in the history
…y is shown on high-contrast mode.

PiperOrigin-RevId: 337015192
  • Loading branch information
sayris authored and copybara-github committed Oct 14, 2020
1 parent 174c0be commit c71ebfa
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/mdc-card/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
@use '@material/theme/theme';
@use './variables';
@use '@material/theme/theme-color';
@use '@material/dom/mixins' as dom-mixins;

//
// Public
Expand Down Expand Up @@ -64,11 +65,28 @@
@include feature-targeting.targets($feat-structure) {
@include container-layout_;
}

// Transparent card border for high-contrast mode.
&::after {
@include shape-radius(variables.$shape-radius, $query: $query);
@include dom-mixins.transparent-border($query: $query);
@include feature-targeting.targets($feat-structure) {
pointer-events: none;
}
}
}

.mdc-card--outlined {
@include elevation-mixins.elevation(0, $query: $query);
@include outline(variables.$outline-color, $query: $query);

// Outlined card already displays border in high-contrast mode. Overwriting
// styles set above to remove a duplicate border.
&::after {
@include feature-targeting.targets($feat-structure) {
border: none;
}
}
}

.mdc-card__content {
Expand Down
1 change: 1 addition & 0 deletions packages/mdc-card/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"sideEffects": false,
"dependencies": {
"@material/dom": "^7.0.0",
"@material/elevation": "^7.0.0",
"@material/feature-targeting": "^7.0.0",
"@material/ripple": "^7.0.0",
Expand Down

0 comments on commit c71ebfa

Please sign in to comment.