Skip to content

Commit

Permalink
feat(menu): add feature targeting to remaining public mixins (#4317)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalerba authored and kfranqueiro committed Jan 31, 2019
1 parent 385a223 commit 5928c00
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 15 deletions.
46 changes: 31 additions & 15 deletions packages/mdc-menu/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,41 +42,53 @@

@include mdc-feature-targets($feat-structure) {
min-width: $mdc-menu-min-width;
}

.mdc-list-divider {
.mdc-list-divider {
@include mdc-feature-targets($feat-structure) {
margin: 8px 0;
}
}

.mdc-list-item {
.mdc-list-item {
@include mdc-feature-targets($feat-structure) {
cursor: pointer;
user-select: none;
}
}

.mdc-list-item--disabled {
.mdc-list-item--disabled {
@include mdc-feature-targets($feat-structure) {
cursor: auto;
}
}

//stylelint-disable selector-max-type, selector-no-qualifying-type
a.mdc-list-item .mdc-list-item__text,
a.mdc-list-item .mdc-list-item__graphic {
//stylelint-disable selector-no-qualifying-type
a.mdc-list-item .mdc-list-item__text,
a.mdc-list-item .mdc-list-item__graphic {
@include mdc-feature-targets($feat-structure) {
pointer-events: none;
}
// stylelint-enable selector-max-type, selector-no-qualifying-type
}
// stylelint-enable selector-no-qualifying-type
}

// postcss-bem-linter: define menu
.mdc-menu__selection-group {
@include mdc-feature-targets($feat-structure) {
padding: 0;
fill: currentColor;
}

.mdc-list-item {
.mdc-list-item {
@include mdc-feature-targets($feat-structure) {
@include mdc-rtl-reflexive-box(padding, left, 56px);
}
}

// Extra specificity required to override `display` property on `mdc-list-item__graphic`.
.mdc-menu__selection-group-icon {
// Extra specificity required to override `display` property on `mdc-list-item__graphic`.
.mdc-menu__selection-group-icon {
@include mdc-feature-targets($feat-structure) {
@include mdc-rtl-reflexive-position(left, 16px);

display: none;
Expand All @@ -94,10 +106,14 @@
}
}

@mixin mdc-menu-width($width) {
@if unitless($width) {
width: $width * $mdc-menu-width-base;
} @else {
width: $width;
@mixin mdc-menu-width($width, $query: mdc-feature-all()) {
$feat-structure: mdc-feature-create-target($query, color);

@include mdc-feature-targets($feat-structure) {
@if unitless($width) {
width: $width * $mdc-menu-width-base;
} @else {
width: $width;
}
}
}
1 change: 1 addition & 0 deletions test/scss/feature-targeting.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

// Menu
@include mdc-menu($query: mdc-feature-any());
@include mdc-menu-width(0, $query: mdc-feature-any());

// Radio
@include mdc-radio($query: mdc-feature-any());
Expand Down

0 comments on commit 5928c00

Please sign in to comment.