Skip to content

Commit 6a63e55

Browse files
committed
chore(toolbar): deprecate unused landscape row-height variable
* Deprecates the unused landscape row-height variable. The logic for this has been removed a long time ago, and the SCSS variable should be removed at some point. * Makes the host bindings more clear by expanding the truthy and falsy check.
1 parent e1fd13a commit 6a63e55

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

src/lib/toolbar/toolbar.scss

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,28 @@
22
@import '../../cdk/a11y/a11y';
33

44
$mat-toolbar-height-desktop: 64px !default;
5+
$mat-toolbar-height-mobile: 56px !default;
6+
$mat-toolbar-row-padding: 16px !default;
7+
8+
/** @deprecated @deletion-target 8.0.0 */
59
$mat-toolbar-height-mobile-portrait: 56px !default;
10+
/** @deprecated @deletion-target 8.0.0 */
611
$mat-toolbar-height-mobile-landscape: 48px !default;
712

8-
$mat-toolbar-row-padding: 16px !default;
913

10-
11-
@mixin mat-toolbar-height($height) {
12-
.mat-toolbar-multiple-rows {
14+
// In order to avoid breaking changes with an increase of specificity, we introduce the
15+
// `$target-selector` parameter. This allows us to target specific toolbars with a selector
16+
// (e.g. `.mat-toolbar-dense`), or just set the height for the default toolbar classes.
17+
@mixin mat-toolbar-height($height, $target-selector: '') {
18+
// If the toolbar has multiple rows, only set a minimum height to not limit the height of the
19+
// toolbar because it should grow based on the amount of rows.
20+
#{$target-selector}.mat-toolbar-multiple-rows {
1321
min-height: $height;
1422
}
15-
.mat-toolbar-row, .mat-toolbar-single-row {
23+
24+
// If the toolbar element itself acts as the first row, set the height to the same value
25+
// as an actual toolbar row would have.
26+
.mat-toolbar-row, #{$target-selector}.mat-toolbar-single-row {
1627
height: $height;
1728
}
1829
}
@@ -49,10 +60,9 @@ $mat-toolbar-row-padding: 16px !default;
4960
// Set the default height for the toolbar.
5061
@include mat-toolbar-height($mat-toolbar-height-desktop);
5162

52-
// As per specs, mobile devices will use a different height for toolbars than for desktop.
53-
// The height for mobile landscape devices has been ignored since relying on `@media orientation`
54-
// is causing issues on devices with a soft-keyboard.
55-
// See: https://material.io/guidelines/layout/structure.html#structure-app-bar
63+
// As per specs, toolbars should have a different height in mobile devices. This has been
64+
// specified in the old guidelines and is still observable in the new specifications by looking at
65+
// the spec images. See: https://material.io/design/components/app-bars-top.html#anatomy
5666
@media ($mat-xsmall) {
57-
@include mat-toolbar-height($mat-toolbar-height-mobile-portrait);
67+
@include mat-toolbar-height($mat-toolbar-height-mobile);
5868
}

src/lib/toolbar/toolbar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ export class MatToolbarRow {}
4545
inputs: ['color'],
4646
host: {
4747
'class': 'mat-toolbar',
48-
'[class.mat-toolbar-multiple-rows]': 'this._toolbarRows.length',
49-
'[class.mat-toolbar-single-row]': '!this._toolbarRows.length'
48+
'[class.mat-toolbar-multiple-rows]': '_toolbarRows.length > 0',
49+
'[class.mat-toolbar-single-row]': '_toolbarRows.length === 0',
5050
},
5151
changeDetection: ChangeDetectionStrategy.OnPush,
5252
encapsulation: ViewEncapsulation.None,

0 commit comments

Comments
 (0)