|
54 | 54 | } |
55 | 55 | } |
56 | 56 |
|
| 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 | + |
57 | 73 | /// Sets width of MaterialTemporaryDrawerComponent and |
58 | 74 | /// MaterialStackableDrawerComponent |
59 | 75 | /// |
|
65 | 81 | /// } |
66 | 82 | /// ``` |
67 | 83 | /// |
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...)} { |
80 | 87 | left: -$width; |
81 | 88 | width: $width; |
82 | 89 | } |
83 | 90 |
|
84 | | - #{drawer-content('.mat-drawer-expanded')} { |
| 91 | + #{_drawer-content($hostSelector: '.mat-drawer-expanded', $_selector...)} { |
85 | 92 | transform: translateX(100%); |
86 | 93 | } |
87 | 94 |
|
88 | 95 | // We can't change the transform when the component is right aligned |
89 | 96 | // since that'll cause it to animate from the left to the right (and back) |
90 | 97 | // so we keep same transform for both alignments and rely on |
91 | 98 | // the left and right attributes to position the content properly. |
92 | | - #{drawer-content('[end]')} { |
| 99 | + #{_drawer-content($hostSelector: '[end]', $_selector...)} { |
93 | 100 | left: initial; |
94 | 101 | right: -$width; |
95 | 102 | } |
96 | 103 |
|
97 | | - #{drawer-content('[end].mat-drawer-expanded')} { |
| 104 | + #{_drawer-content( |
| 105 | + $hostSelector: '[end].mat-drawer-expanded', $_selector...)} { |
98 | 106 | transform: translateX(-100%); |
99 | 107 | } |
100 | 108 | } |
|
0 commit comments