Skip to content

Commit 78d54fc

Browse files
devversionjelbourn
authored andcommitted
update(toolbar): add responsive heights as per spec (#2157)
* update(toolbar): add responsive heights as per spec * Adds media queries to dynamically adjust the height of the toolbar according to the specifications. https://material.google.com/layout/structure.html#structure-app-bar Closes #2085. * Remove extra blank line
1 parent 2269a46 commit 78d54fc

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

src/lib/core/style/_variables.scss

+3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ $md-body-font-size-base: rem(1.4) !default;
66
$md-font-family: Roboto, 'Helvetica Neue', sans-serif !default;
77

88
// Media queries
9+
// TODO: Find a way to respect media query ranges.
10+
// TODO: For example the xs-breakpoint should not interfere with the sm-breakpoint.
911
$md-xsmall: 'max-width: 600px';
12+
$md-small: 'max-width: 960px';
1013

1114
// TODO: Revisit all z-indices before beta
1215
// z-index master list

src/lib/toolbar/toolbar.scss

+25-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
11
@import '../core/style/variables';
22

3+
$md-toolbar-height-desktop: 64px !default;
4+
$md-toolbar-height-mobile-portrait: 56px !default;
5+
$md-toolbar-height-mobile-landscape: 48px !default;
36

4-
$md-toolbar-min-height: 64px !default;
57
$md-toolbar-font-size: 20px !default;
68
$md-toolbar-padding: 16px !default;
79

810

11+
@mixin md-toolbar-height($height) {
12+
md-toolbar {
13+
min-height: $height;
14+
}
15+
md-toolbar-row {
16+
height: $height;
17+
}
18+
}
19+
920
md-toolbar {
1021
display: flex;
1122
box-sizing: border-box;
1223

1324
width: 100%;
14-
min-height: $md-toolbar-min-height;
1525

1626
// Font Styling
1727
font-size: $md-toolbar-font-size;
@@ -27,10 +37,22 @@ md-toolbar {
2737
box-sizing: border-box;
2838

2939
width: 100%;
30-
height: $md-toolbar-min-height;
3140

3241
// Flexbox Vertical Alignment
3342
flex-direction: row;
3443
align-items: center;
3544
}
3645
}
46+
47+
// Set the default height for the toolbar.
48+
@include md-toolbar-height($md-toolbar-height-desktop);
49+
50+
// Specific height for mobile devices in portrait mode.
51+
@media ($md-xsmall) and (orientation: portrait) {
52+
@include md-toolbar-height($md-toolbar-height-mobile-portrait);
53+
}
54+
55+
// Specific height for mobile devices in landscape mode.
56+
@media ($md-small) and (orientation: landscape) {
57+
@include md-toolbar-height($md-toolbar-height-mobile-landscape);
58+
}

0 commit comments

Comments
 (0)