Skip to content
This repository was archived by the owner on May 20, 2023. It is now read-only.

Commit e200fb0

Browse files
har79nshahan
authored andcommitted
move function out of mixin.
Unsupported in Dart sass compiler. PiperOrigin-RevId: 186497978
1 parent e1017f4 commit e200fb0

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

lib/app_layout/_mixins.scss

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,22 @@
5454
}
5555
}
5656

57+
/// Internal function to generate selector for drawer-content.
58+
///
59+
/// Required to allow the temporary and stackable drawers to use the width mixin
60+
/// rather than duplicating the styles, which would get out of date.
61+
///
62+
/// * $host encapsulates the styles within :host.
63+
/// * $hostSelector appends a selector to the host material-drawer.
64+
/// * $drawerSelector appends a selector to .drawer-content.
65+
@function _drawer-content(
66+
$host: false, $hostSelector: '', $drawerSelector: '') {
67+
$parent: if($host,
68+
if($hostSelector == '', ':host', ':host(#{$hostSelector})'),
69+
'&#{$hostSelector}');
70+
@return '#{$parent} ::ng-deep > .drawer-content#{$drawerSelector}';
71+
}
72+
5773
/// Sets width of MaterialTemporaryDrawerComponent and
5874
/// MaterialStackableDrawerComponent
5975
///
@@ -65,36 +81,28 @@
6581
/// }
6682
/// ```
6783
///
68-
/// The additional params are for internal use only:
69-
/// * $host encapsulates the styles within :host.
70-
/// * $drawerSelector appends an extra selector to .drawer-content.
71-
@mixin mat-temporary-drawer-width($width, $host: false, $drawerSelector: '') {
72-
@function drawer-content($selector: '') {
73-
$parent: if($host,
74-
if($selector == '', ':host', ':host(#{$selector})'),
75-
'&#{$selector}');
76-
@return '#{$parent} ::ng-deep > .drawer-content#{$drawerSelector}';
77-
}
78-
79-
#{drawer-content()} {
84+
/// _selector is for internal use only.
85+
@mixin mat-temporary-drawer-width($width, $_selector...) {
86+
#{_drawer-content($_selector...)} {
8087
left: -$width;
8188
width: $width;
8289
}
8390

84-
#{drawer-content('.mat-drawer-expanded')} {
91+
#{_drawer-content($hostSelector: '.mat-drawer-expanded', $_selector...)} {
8592
transform: translateX(100%);
8693
}
8794

8895
// We can't change the transform when the component is right aligned
8996
// since that'll cause it to animate from the left to the right (and back)
9097
// so we keep same transform for both alignments and rely on
9198
// the left and right attributes to position the content properly.
92-
#{drawer-content('[end]')} {
99+
#{_drawer-content($hostSelector: '[end]', $_selector...)} {
93100
left: initial;
94101
right: -$width;
95102
}
96103

97-
#{drawer-content('[end].mat-drawer-expanded')} {
104+
#{_drawer-content(
105+
$hostSelector: '[end].mat-drawer-expanded', $_selector...)} {
98106
transform: translateX(-100%);
99107
}
100108
}

0 commit comments

Comments
 (0)