toolbar.ios.scss 8.6KB

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