UNPKG

5.63 kBSCSSView Raw
1//
2// Copyright 2018 Google Inc.
3//
4// Permission is hereby granted, free of charge, to any person obtaining a copy
5// of this software and associated documentation files (the "Software"), to deal
6// in the Software without restriction, including without limitation the rights
7// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8// copies of the Software, and to permit persons to whom the Software is
9// furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20// THE SOFTWARE.
21//
22
23// stylelint-disable selector-class-pattern --
24// Selector '.mdc-*' should only be used in this project.
25
26@use '@material/elevation/mixins' as elevation-mixins;
27@use '@material/animation/variables' as animation-variables;
28@use '@material/rtl/rtl';
29@use '@material/typography/typography';
30@use './mixins';
31@use './variables';
32
33// postcss-bem-linter: define top-app-bar
34.mdc-top-app-bar {
35 @include mixins.fill-color-accessible(primary);
36 @include mixins.icon-ink-color(on-primary);
37
38 display: flex;
39 position: fixed;
40 flex-direction: column;
41 justify-content: space-between;
42 box-sizing: border-box;
43 width: 100%;
44 z-index: 4;
45
46 &__row {
47 display: flex;
48 position: relative;
49 box-sizing: border-box;
50 width: 100%;
51 height: variables.$row-height;
52 }
53
54 &__section {
55 display: inline-flex;
56 flex: 1 1 auto;
57 align-items: center;
58 min-width: 0;
59 padding: variables.$section-vertical-padding
60 variables.$section-horizontal-padding;
61 z-index: 1;
62
63 &--align-start {
64 justify-content: flex-start;
65 order: -1;
66 }
67
68 &--align-end {
69 justify-content: flex-end;
70 order: 1;
71 }
72 }
73
74 &__title {
75 @include typography.typography(headline6);
76 @include rtl.reflexive-box(padding, left, variables.$title-left-padding);
77
78 text-overflow: ellipsis;
79 white-space: nowrap;
80 overflow: hidden;
81 z-index: 1;
82 }
83}
84
85@at-root {
86 @include mixins.short-shape-radius(24px);
87}
88
89.mdc-top-app-bar--short {
90 top: 0;
91 @include rtl.ignore-next-line();
92 right: auto;
93 @include rtl.ignore-next-line();
94 left: 0;
95 width: 100%;
96 transition: width 250ms animation-variables.$standard-curve-timing-function;
97
98 @include rtl.rtl {
99 @include rtl.ignore-next-line();
100 right: 0;
101 @include rtl.ignore-next-line();
102 left: auto;
103 }
104
105 .mdc-top-app-bar__row {
106 height: variables.$mobile-row-height;
107 }
108
109 .mdc-top-app-bar__section {
110 padding: variables.$mobile-section-padding;
111 }
112
113 .mdc-top-app-bar__title {
114 transition: opacity 200ms
115 animation-variables.$standard-curve-timing-function;
116 opacity: 1;
117 }
118}
119
120.mdc-top-app-bar--short-collapsed {
121 @include elevation-mixins.elevation(4);
122
123 width: variables.$short-collapsed-width;
124 transition: width 300ms animation-variables.$standard-curve-timing-function;
125
126 .mdc-top-app-bar__title {
127 display: none;
128 }
129
130 .mdc-top-app-bar__action-item {
131 transition: padding 150ms
132 animation-variables.$standard-curve-timing-function;
133 }
134}
135
136.mdc-top-app-bar--short-collapsed.mdc-top-app-bar--short-has-action-item {
137 width: variables.$short-collapsed-width * 2;
138
139 .mdc-top-app-bar__section--align-end {
140 @include rtl.reflexive-box(padding, right, 12px);
141 }
142}
143
144.mdc-top-app-bar--dense {
145 .mdc-top-app-bar__row {
146 height: variables.$dense-row-height;
147 }
148
149 .mdc-top-app-bar__section {
150 padding: 0 variables.$dense-section-horizontal-padding;
151 }
152
153 .mdc-top-app-bar__title {
154 @include rtl.reflexive-box(
155 padding,
156 left,
157 variables.$dense-title-left-padding
158 );
159 }
160}
161
162.mdc-top-app-bar--prominent {
163 .mdc-top-app-bar__row {
164 height: variables.$prominent-row-height;
165 }
166
167 .mdc-top-app-bar__title {
168 align-self: flex-end;
169 padding-bottom: variables.$prominent-title-bottom-padding;
170 }
171
172 .mdc-top-app-bar__action-item,
173 .mdc-top-app-bar__navigation-icon {
174 align-self: flex-start;
175 }
176}
177
178.mdc-top-app-bar--fixed {
179 transition: box-shadow 200ms linear;
180}
181
182.mdc-top-app-bar--fixed-scrolled {
183 @include elevation-mixins.elevation(4);
184
185 transition: box-shadow 200ms linear;
186}
187
188// Specific styles for dense and prominent styled top app bar
189.mdc-top-app-bar--dense.mdc-top-app-bar--prominent {
190 .mdc-top-app-bar__row {
191 height: variables.$dense-row-height * 2;
192 }
193
194 .mdc-top-app-bar__section {
195 padding: 0 variables.$section-horizontal-padding;
196 }
197
198 .mdc-top-app-bar__title {
199 @include rtl.reflexive-box(padding, left, variables.$title-left-padding);
200
201 padding-bottom: variables.$dense-prominent-title-bottom-padding;
202 }
203}
204
205.mdc-top-app-bar--fixed-adjust {
206 padding-top: variables.$row-height;
207}
208
209.mdc-top-app-bar--dense-fixed-adjust {
210 padding-top: variables.$dense-row-height;
211}
212
213.mdc-top-app-bar--short-fixed-adjust {
214 padding-top: variables.$mobile-row-height;
215}
216
217.mdc-top-app-bar--prominent-fixed-adjust {
218 padding-top: variables.$prominent-row-height;
219}
220
221.mdc-top-app-bar--dense-prominent-fixed-adjust {
222 padding-top: variables.$dense-row-height * 2;
223}
224
225// Mobile Styles
226@include mixins.mobile-breakpoint_;