mdc-top-app-bar.scss 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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. // stylelint-disable selector-class-pattern --
  23. // Selector '.mdc-*' should only be used in this project.
  24. @use '@material/elevation/mixins' as elevation-mixins;
  25. @use '@material/animation/variables' as animation-variables;
  26. @use '@material/rtl/rtl';
  27. @use '@material/typography/typography';
  28. @use './mixins';
  29. @use './variables';
  30. // postcss-bem-linter: define top-app-bar
  31. .mdc-top-app-bar {
  32. @include mixins.fill-color-accessible(primary);
  33. @include mixins.icon-ink-color(on-primary);
  34. display: flex;
  35. position: fixed;
  36. flex-direction: column;
  37. justify-content: space-between;
  38. box-sizing: border-box;
  39. width: 100%;
  40. z-index: 4;
  41. &__row {
  42. display: flex;
  43. position: relative;
  44. box-sizing: border-box;
  45. width: 100%;
  46. height: variables.$row-height;
  47. }
  48. &__section {
  49. display: inline-flex;
  50. flex: 1 1 auto;
  51. align-items: center;
  52. min-width: 0;
  53. padding: variables.$section-vertical-padding
  54. variables.$section-horizontal-padding;
  55. z-index: 1;
  56. &--align-start {
  57. justify-content: flex-start;
  58. order: -1;
  59. }
  60. &--align-end {
  61. justify-content: flex-end;
  62. order: 1;
  63. }
  64. }
  65. &__title {
  66. @include typography.typography(headline6);
  67. @include rtl.reflexive-box(padding, left, variables.$title-left-padding);
  68. text-overflow: ellipsis;
  69. white-space: nowrap;
  70. overflow: hidden;
  71. z-index: 1;
  72. }
  73. }
  74. @at-root {
  75. @include mixins.short-shape-radius(24px);
  76. }
  77. .mdc-top-app-bar--short {
  78. top: 0;
  79. @include rtl.ignore-next-line();
  80. right: auto;
  81. @include rtl.ignore-next-line();
  82. left: 0;
  83. width: 100%;
  84. transition: width 250ms animation-variables.$standard-curve-timing-function;
  85. @include rtl.rtl {
  86. @include rtl.ignore-next-line();
  87. right: 0;
  88. @include rtl.ignore-next-line();
  89. left: auto;
  90. }
  91. .mdc-top-app-bar__row {
  92. height: variables.$mobile-row-height;
  93. }
  94. .mdc-top-app-bar__section {
  95. padding: variables.$mobile-section-padding;
  96. }
  97. .mdc-top-app-bar__title {
  98. transition: opacity 200ms
  99. animation-variables.$standard-curve-timing-function;
  100. opacity: 1;
  101. }
  102. }
  103. .mdc-top-app-bar--short-collapsed {
  104. @include elevation-mixins.elevation(4);
  105. width: variables.$short-collapsed-width;
  106. transition: width 300ms animation-variables.$standard-curve-timing-function;
  107. .mdc-top-app-bar__title {
  108. display: none;
  109. }
  110. .mdc-top-app-bar__action-item {
  111. transition: padding 150ms
  112. animation-variables.$standard-curve-timing-function;
  113. }
  114. }
  115. .mdc-top-app-bar--short-collapsed.mdc-top-app-bar--short-has-action-item {
  116. width: variables.$short-collapsed-width * 2;
  117. .mdc-top-app-bar__section--align-end {
  118. @include rtl.reflexive-box(padding, right, 12px);
  119. }
  120. }
  121. .mdc-top-app-bar--dense {
  122. .mdc-top-app-bar__row {
  123. height: variables.$dense-row-height;
  124. }
  125. .mdc-top-app-bar__section {
  126. padding: 0 variables.$dense-section-horizontal-padding;
  127. }
  128. .mdc-top-app-bar__title {
  129. @include rtl.reflexive-box(
  130. padding,
  131. left,
  132. variables.$dense-title-left-padding
  133. );
  134. }
  135. }
  136. .mdc-top-app-bar--prominent {
  137. .mdc-top-app-bar__row {
  138. height: variables.$prominent-row-height;
  139. }
  140. .mdc-top-app-bar__title {
  141. align-self: flex-end;
  142. padding-bottom: variables.$prominent-title-bottom-padding;
  143. }
  144. .mdc-top-app-bar__action-item,
  145. .mdc-top-app-bar__navigation-icon {
  146. align-self: flex-start;
  147. }
  148. }
  149. .mdc-top-app-bar--fixed {
  150. transition: box-shadow 200ms linear;
  151. }
  152. .mdc-top-app-bar--fixed-scrolled {
  153. @include elevation-mixins.elevation(4);
  154. transition: box-shadow 200ms linear;
  155. }
  156. // Specific styles for dense and prominent styled top app bar
  157. .mdc-top-app-bar--dense.mdc-top-app-bar--prominent {
  158. .mdc-top-app-bar__row {
  159. height: variables.$dense-row-height * 2;
  160. }
  161. .mdc-top-app-bar__section {
  162. padding: 0 variables.$section-horizontal-padding;
  163. }
  164. .mdc-top-app-bar__title {
  165. @include rtl.reflexive-box(padding, left, variables.$title-left-padding);
  166. padding-bottom: variables.$dense-prominent-title-bottom-padding;
  167. }
  168. }
  169. .mdc-top-app-bar--fixed-adjust {
  170. padding-top: variables.$row-height;
  171. }
  172. .mdc-top-app-bar--dense-fixed-adjust {
  173. padding-top: variables.$dense-row-height;
  174. }
  175. .mdc-top-app-bar--short-fixed-adjust {
  176. padding-top: variables.$mobile-row-height;
  177. }
  178. .mdc-top-app-bar--prominent-fixed-adjust {
  179. padding-top: variables.$prominent-row-height;
  180. }
  181. .mdc-top-app-bar--dense-prominent-fixed-adjust {
  182. padding-top: variables.$dense-row-height * 2;
  183. }
  184. // Mobile Styles
  185. @include mixins.mobile-breakpoint_;