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

feat(elevation): Update elevation mixins #5304

Merged
merged 3 commits into from
Dec 4, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/mdc-button/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ $query: mdc-feature-all()) {
@include mdc-typography(button, $query);
@include mdc-button-horizontal-padding($mdc-button-horizontal-padding, $query);
@include mdc-elevation-overlay-surface-position($query: $query);
@include mdc-elevation-overlay-size(100%, $query: $query);
@include mdc-elevation-overlay-dimensions(100%, $query: $query);

@include mdc-feature-targets($feat-structure) {
display: inline-flex;
Expand Down
2 changes: 1 addition & 1 deletion packages/mdc-chips/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ $mdc-chip-ripple-target: ".mdc-chip__ripple";
@include mdc-chip-density($density-scale: 0, $query: $query);
@include mdc-chip-leading-icon-margin($query: $query);
@include mdc-elevation-overlay-surface-position($query: $query);
@include mdc-elevation-overlay-size(100%, $query: $query);
@include mdc-elevation-overlay-dimensions(100%, $query: $query);

@include mdc-feature-targets($feat-structure) {
display: inline-flex;
Expand Down
2 changes: 1 addition & 1 deletion packages/mdc-dialog/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@

.mdc-dialog__surface {
@include mdc-elevation-overlay-surface-position($query: $query);
@include mdc-elevation-overlay-size(100%, $query: $query);
@include mdc-elevation-overlay-dimensions(100%, $query: $query);
@include mdc-elevation(24, $query: $query);

@include mdc-feature-targets($feat-structure) {
Expand Down
2 changes: 1 addition & 1 deletion packages/mdc-elevation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Mixin | Description
`mdc-elevation-overlay-common` | Called once per application to setup the universal elevation overlay styles
`mdc-elevation-shadow($box-shadow)` | Sets the `box-shadow` of the closest parent selector
`mdc-elevation-overlay-surface-position` | Sets the positioning of the overlay's surface element so that the overlay can be appropriately centered
`mdc-elevation-overlay-size($width, $height: $width)` | Sets the width and height of the elevation overlay
`mdc-elevation-overlay-dimensions($width, $height: $width, $has-content-sizing: false)` | Sets the dimensions of the elevation overlay
patrickrodee marked this conversation as resolved.
Show resolved Hide resolved
`mdc-elevation-overlay-fill-color($color)` | Sets the color of the elevation overlay
`mdc-elevation-overlay-opacity($opacity)` | Sets the opacity of the elevation overlay

Expand Down
24 changes: 16 additions & 8 deletions packages/mdc-elevation/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@
@include mdc-feature-targets($feat-structure) {
@include mdc-base-emit-once("mdc-elevation/common/structure") {
position: absolute;
top: 50%;
/* @noflip */
left: 50%;
transform: translate(-50%, -50%);
border-radius: inherit;
opacity: 0;
pointer-events: none;
Expand Down Expand Up @@ -109,18 +105,30 @@
}

///
/// Sets the elevation overlay size.
/// Sets the dimensions of the elevation overlay, including positioning and sizing.
///
/// @param {Number} $width - The width of the elevation overlay.
/// @param {Number} $height [$width] - The height of the elevation overlay.
/// @param {Number} $width - The width of the elevation overlay
/// @param {Number} [$height] - The height of the elevation overlay
/// @param {Boolean} [$has-content-sizing] - Set to false if the container has no content sizing
///
@mixin mdc-elevation-overlay-size($width, $height: $width, $query: mdc-feature-all()) {
@mixin mdc-elevation-overlay-dimensions($width, $height: $width, $has-content-sizing: true, $query: mdc-feature-all()) {
$feat-structure: mdc-feature-create-target($query, structure);

@include mdc-elevation-overlay-selector_ {
@include mdc-feature-targets($feat-structure) {
width: $width;
height: $height;

@if $has-content-sizing {
top: 0;
/* @noflip */
left: 0;
} @else {
top: 50%;
/* @noflip */
left: 50%;
transform: translate(-50%, -50%);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/mdc-fab/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ $mdc-fab-icon-enter-duration_: 180ms;

@mixin mdc-fab-base_($query: mdc-feature-all()) {
@include mdc-elevation-overlay-surface-position($query: $query);
@include mdc-elevation-overlay-size(100%, $query: $query);
@include mdc-elevation-overlay-dimensions(100%, $query: $query);
@include mdc-elevation(6, $query: $query);
@include mdc-fab-shape-radius(50%, $query: $query);

Expand Down
4 changes: 2 additions & 2 deletions packages/mdc-menu/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
// Include mdc-list selector to ensure list-inside-menu overrides default list styles
.mdc-list {
@include mdc-list-item-primary-text-ink-color($mdc-menu-ink-color, $query);
// @include mdc-elevation-overlay-surface-position($query: $query);
// @include mdc-elevation-overlay-size(100%, $query: $query);
@include mdc-elevation-overlay-surface-position($query: $query);
@include mdc-elevation-overlay-dimensions(100%, $query: $query);
}

.mdc-list-divider {
Expand Down
2 changes: 1 addition & 1 deletion test/scss/_feature-targeting-test.scss
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
@include mdc-elevation(0, $query: $query);
@include mdc-elevation-shadow(none, $query: $query);
@include mdc-elevation-overlay-parent($query: $query);
@include mdc-elevation-overlay-size(100%, $query: $query);
@include mdc-elevation-overlay-dimensions(100%, $query: $query);
@include mdc-elevation-overlay-fill-color(red, $query: $query);
@include mdc-elevation-overlay-opacity(99%, $query: $query);

Expand Down