Skip to content

Commit

Permalink
fix(rtl): do not emit if a left/right value or replacement is null
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 370624600
  • Loading branch information
asyncLiz authored and Copybara-Service committed Apr 27, 2021
1 parent 55ad2d7 commit ec4ac52
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions packages/mdc-rtl/_rtl.scss
Expand Up @@ -292,14 +292,30 @@ $include: true !default;
@if $left-replace == null and $right-replace == null {
@error 'mdc-rtl: $replace may only be used with strings but neither left nor right values are strings.';
}

// If any replacements are null, treat the entire value as null (do not
// emit anything).
@each $name, $replacement in $replace {
@if $replacement == null {
$left-value: null;
$right-value: null;
}
}
}

@include _property($left-property, $left-value, $replace: $left-replace);
@include _property($right-property, $right-value, $replace: $right-replace);
// Do not emit if either value are null
@if $left-value and $right-value {
@include _property($left-property, $left-value, $replace: $left-replace);
@include _property($right-property, $right-value, $replace: $right-replace);

@include rtl {
@include _property($left-property, $right-value, $replace: $right-replace);
@include _property($right-property, $left-value, $replace: $left-replace);
@include rtl {
@include _property(
$left-property,
$right-value,
$replace: $right-replace
);
@include _property($right-property, $left-value, $replace: $left-replace);
}
}
}

Expand Down

0 comments on commit ec4ac52

Please sign in to comment.