123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. @import "../../themes/ionic.globals.md";
  2. // Material Design Toolbar
  3. // --------------------------------------------------
  4. /// @prop - Order of the toolbar elements
  5. $toolbar-order-md: (
  6. back-button: 0,
  7. menu-toggle-start: 1,
  8. buttons-left: 2,
  9. content: 3,
  10. buttons-start: 4,
  11. buttons-end: 5,
  12. buttons-right: 6,
  13. menu-toggle-end: 7,
  14. ) !default;
  15. /// @prop - Font size of the toolbar title
  16. $toolbar-md-title-font-size: 2rem !default;
  17. /// @prop - Text color of the toolbar title
  18. $toolbar-md-title-text-color: color-contrast($colors-md, $toolbar-md-background, md) !default;
  19. /// @prop - Font size of the toolbar button
  20. $toolbar-md-button-font-size: 1.4rem !default;
  21. /// @prop - Text color of the toolbar button
  22. $toolbar-md-button-color: $toolbar-md-title-text-color !default;
  23. /// @prop - Border radius of the toolbar button
  24. $toolbar-md-button-border-radius: 2px !default;
  25. /// @prop - Font weight of the strong toolbar button
  26. $toolbar-md-button-strong-font-weight: bold !default;
  27. /// @prop - Height of the navigation bar
  28. $navbar-md-height: $toolbar-md-height !default;
  29. $toolbar-button-md-strong-font-weight: bold !default;
  30. .toolbar-md {
  31. @include padding($toolbar-md-padding);
  32. min-height: $toolbar-md-height;
  33. }
  34. // Material Design Toolbar Background
  35. // --------------------------------------------------
  36. .toolbar-background-md {
  37. border-color: $toolbar-md-border-color;
  38. background: $toolbar-md-background;
  39. }
  40. // Material Design Header / Footer / Tabs Box Shadow
  41. // --------------------------------------------------
  42. .header-md::after,
  43. .tabs-md[tabsPlacement="top"] > .tabbar::after,
  44. .footer-md::before,
  45. .tabs-md[tabsPlacement="bottom"] > .tabbar::before {
  46. // using datauri png background image for improved scroll performance
  47. // rather than using `box-shadow: 0 2px 5px rgba(0,0,0,0.26);`
  48. // noticable performance difference on older Android devices
  49. @include position(null, null, -5px, 0);
  50. @include background-position(start, 0, top, -2px);
  51. position: absolute;
  52. width: 100%;
  53. height: 5px;
  54. background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAHBAMAAADzDtBxAAAAD1BMVEUAAAAAAAAAAAAAAAAAAABPDueNAAAABXRSTlMUCS0gBIh/TXEAAAAaSURBVAjXYxCEAgY4UIICBmMogMsgFLtAAQCNSwXZKOdPxgAAAABJRU5ErkJggg==);
  55. background-repeat: repeat-x;
  56. content: "";
  57. }
  58. .footer-md::before,
  59. .tabs-md[tabsPlacement="bottom"] > .tabbar::before {
  60. @include position(-2px, null, auto, null);
  61. @include background-position(start, 0, top, 0);
  62. height: 2px;
  63. }
  64. .header-md[no-border]::after,
  65. .footer-md[no-border]::before,
  66. .tabs-md[tabsPlacement="top"][no-border] > .tabbar::after,
  67. .tabs-md[tabsPlacement="bottom"][no-border] > .tabbar::before {
  68. display: none;
  69. }
  70. // Material Design Toolbar Content
  71. // --------------------------------------------------
  72. .toolbar-content-md {
  73. flex: 1;
  74. order: map-get($toolbar-order-md, content);
  75. min-width: 0;
  76. max-width: 100%;
  77. }
  78. .toolbar-title-md {
  79. @include padding(0, 12px);
  80. font-size: $toolbar-md-title-font-size;
  81. font-weight: 500;
  82. color: $toolbar-md-title-text-color;
  83. }
  84. @mixin md-toolbar-theme($color-name, $color-base, $color-contrast) {
  85. .toolbar-md-#{$color-name} {
  86. .toolbar-background-md {
  87. background: $color-base;
  88. }
  89. .bar-button-clear-md,
  90. .bar-button-default-md,
  91. .bar-button-outline-md,
  92. .toolbar-title-md {
  93. color: $color-contrast;
  94. }
  95. .bar-button-clear-md,
  96. .bar-button-default-md,
  97. .bar-button-outline-md {
  98. .button-effect {
  99. background-color: $color-contrast;
  100. }
  101. }
  102. .bar-button-outline-md {
  103. border-color: $color-contrast;
  104. }
  105. @each $color-name, $color-base, $color-contrast in get-colors($colors-md, md) {
  106. @include md-bar-button-default($color-name, $color-base, $color-contrast);
  107. @include md-bar-button-outline($color-name, $color-base, $color-contrast);
  108. @include md-bar-button-solid($color-name, $color-base, $color-contrast);
  109. }
  110. }
  111. }
  112. // Material Design Toolbar Button Placement
  113. // --------------------------------------------------
  114. .bar-buttons-md {
  115. order: map-get($toolbar-order-md, buttons-start);
  116. transform: translateZ(0);
  117. }
  118. .bar-buttons-md[left] {
  119. order: map-get($toolbar-order-md, buttons-left);
  120. }
  121. .bar-button-md:first-child {
  122. @include margin-horizontal(0, null);
  123. }
  124. .bar-buttons-md[end] {
  125. @include text-align(end);
  126. order: map-get($toolbar-order-md, buttons-end);
  127. }
  128. .bar-buttons-md[right] {
  129. @include text-align(right);
  130. order: map-get($toolbar-order-md, buttons-right);
  131. }
  132. // Material Design Toolbar Button Default
  133. // --------------------------------------------------
  134. .bar-button-md {
  135. @include margin(0, .2rem, 0, .2rem);
  136. @include padding(0, 5px);
  137. @include border-radius($toolbar-md-button-border-radius);
  138. height: 32px;
  139. border: 0;
  140. font-size: $toolbar-md-button-font-size;
  141. font-weight: 500;
  142. text-transform: uppercase;
  143. }
  144. .bar-button-solid-md,
  145. .bar-button-outline-md {
  146. // restrict the ripple to button size
  147. overflow: hidden;
  148. }
  149. @mixin md-bar-button-default($color-name, $color-base, $color-contrast) {
  150. .bar-button-#{$color-name}-md,
  151. .bar-button-clear-md-#{$color-name},
  152. .bar-button-md-#{$color-name} {
  153. color: $color-base;
  154. background-color: transparent;
  155. &:hover:not(.disable-hover) {
  156. color: $color-base;
  157. }
  158. }
  159. }
  160. // Material Design Toolbar Button Outline
  161. // --------------------------------------------------
  162. .bar-button-outline-md {
  163. border-width: 1px;
  164. border-style: solid;
  165. border-color: $toolbar-md-button-color;
  166. color: $toolbar-md-button-color;
  167. background-color: transparent;
  168. &:hover:not(.disable-hover) {
  169. opacity: .4;
  170. }
  171. &.activated {
  172. background-color: transparent;
  173. }
  174. .button-effect {
  175. background-color: $toolbar-md-button-color;
  176. }
  177. }
  178. @mixin md-bar-button-outline($color-name, $color-base, $color-contrast) {
  179. .bar-button-outline-md-#{$color-name} {
  180. $fg-color: color-shade($color-base);
  181. border-color: $fg-color;
  182. color: $fg-color;
  183. background-color: transparent;
  184. &.activated {
  185. background-color: transparent;
  186. }
  187. .button-effect {
  188. background-color: $fg-color;
  189. }
  190. }
  191. }
  192. // Material Design Toolbar Button Solid
  193. // --------------------------------------------------
  194. .bar-button-solid-md {
  195. color: color-contrast($colors-md, $toolbar-md-button-color, md);
  196. background-color: $toolbar-md-button-color;
  197. &:hover:not(.disable-hover) {
  198. color: color-contrast($colors-md, $toolbar-md-button-color, md);
  199. }
  200. &.activated {
  201. color: color-contrast($colors-md, $toolbar-md-button-color, md);
  202. background-color: color-shade($toolbar-md-button-color);
  203. }
  204. }
  205. @mixin md-bar-button-solid($color-name, $color-base, $color-contrast) {
  206. .bar-button-solid-md-#{$color-name} {
  207. color: $color-contrast;
  208. background-color: $color-base;
  209. &.activated {
  210. color: $color-contrast;
  211. background-color: color-shade($color-base);
  212. }
  213. }
  214. }
  215. // Material Design Toolbar Button Icon
  216. // --------------------------------------------------
  217. .bar-button-md.bar-button-icon-start ion-icon {
  218. @include padding-horizontal(null, .3em);
  219. font-size: 1.4em;
  220. line-height: .67;
  221. pointer-events: none;
  222. }
  223. .bar-button-md.bar-button-icon-end ion-icon {
  224. @include padding-horizontal(.4em, null);
  225. font-size: 1.4em;
  226. line-height: .67;
  227. pointer-events: none;
  228. }
  229. .bar-button-md[icon-only] {
  230. @include padding(0);
  231. }
  232. .bar-button-md[icon-only] ion-icon {
  233. @include padding(0, .1em);
  234. min-width: 28px;
  235. font-size: 1.8em;
  236. line-height: .67;
  237. pointer-events: none;
  238. }
  239. // Material Design Toolbar Back Button
  240. // --------------------------------------------------
  241. .back-button-md {
  242. @include margin(0, 6px);
  243. min-width: 44px;
  244. box-shadow: none;
  245. }
  246. .back-button-icon-md {
  247. @include margin(0);
  248. @include padding(0, 6px);
  249. @include text-align(start);
  250. font-size: 2.4rem;
  251. font-weight: normal;
  252. }
  253. // Material Design Toolbar Menu Toggle
  254. // --------------------------------------------------
  255. .bar-button-menutoggle-md {
  256. @include margin(0, 6px);
  257. @include padding(0, 2px);
  258. order: map-get($toolbar-order-md, menu-toggle-start);
  259. min-width: 44px;
  260. }
  261. .bar-button-menutoggle-md ion-icon {
  262. @include padding(0, 6px);
  263. font-size: 2.4rem;
  264. }
  265. .bar-button-menutoggle-md[end],
  266. .bar-button-menutoggle-md[right] {
  267. @include margin(0, 2px);
  268. order: map-get($toolbar-order-md, menu-toggle-end);
  269. min-width: 28px;
  270. }
  271. // Material Design Toolbar Color Generation
  272. // --------------------------------------------------
  273. @include md-bar-button-default(default, $toolbar-md-button-color, color-contrast($colors-md, $toolbar-md-button-color, md));
  274. @include md-bar-button-default(clear, $toolbar-md-button-color, color-contrast($colors-md, $toolbar-md-button-color, md));
  275. @each $color-name, $color-base, $color-contrast in get-colors($colors-md, md) {
  276. @include md-toolbar-theme($color-name, $color-base, $color-contrast);
  277. @include md-bar-button-default($color-name, $color-base, $color-contrast);
  278. @include md-bar-button-outline($color-name, $color-base, $color-contrast);
  279. @include md-bar-button-solid($color-name, $color-base, $color-contrast);
  280. }
  281. // MD strong Button
  282. // --------------------------------------------------
  283. .bar-button-strong-md {
  284. font-weight: $toolbar-md-button-strong-font-weight;
  285. }