cordova.scss 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. @import "../themes/ionic.globals";
  2. // Cordova Status Bar Padding iOS Platform
  3. // --------------------------------------------------------------------------------
  4. /// @prop - The breakpoint when a modal becomes inset
  5. $cordova-statusbar-padding-modal-max-width: 767px !default;
  6. @mixin statusbar-padding($toolbar-height, $toolbar-padding, $content-padding, $cordova-statusbar-padding, $modal-max-width, $style-title: false) {
  7. ion-nav > .ion-page,
  8. ion-nav > .ion-page > ion-header,
  9. ion-tab > .ion-page,
  10. ion-tab > .ion-page > ion-header,
  11. ion-tabs > .ion-page.tab-subpage > ion-header,
  12. ion-menu > .menu-inner,
  13. ion-menu > .menu-inner > ion-header {
  14. @include toolbar-statusbar-padding($toolbar-height, $toolbar-padding, $content-padding, $cordova-statusbar-padding);
  15. // If we should style the title elements in the toolbar
  16. @if ($style-title) {
  17. @include toolbar-title-statusbar-padding($toolbar-height, $toolbar-padding, $content-padding, $cordova-statusbar-padding);
  18. }
  19. }
  20. @media only screen and (max-width: $modal-max-width) {
  21. .modal-wrapper > .ion-page > ion-header {
  22. @include toolbar-statusbar-padding($toolbar-height, $toolbar-padding, $content-padding, $cordova-statusbar-padding);
  23. // If we should style the title elements in the toolbar
  24. @if ($style-title) {
  25. @include toolbar-title-statusbar-padding($toolbar-height, $toolbar-padding, $content-padding, $cordova-statusbar-padding);
  26. }
  27. }
  28. }
  29. }
  30. // The first-child should get modified padding-top for the status bar
  31. // --------------------------------------------------------------------------------
  32. @mixin toolbar-statusbar-padding($toolbar-height, $toolbar-padding, $content-padding, $cordova-statusbar-padding) {
  33. > .toolbar.statusbar-padding:first-child {
  34. @include padding(calc(#{$cordova-statusbar-padding} + #{$toolbar-padding}), null, null, null);
  35. @include padding(calc(constant(safe-area-inset-top) + #{$toolbar-padding}), null, null, null);
  36. @include padding(calc(env(safe-area-inset-top) + #{$toolbar-padding}), null, null, null);
  37. min-height: calc(#{$toolbar-height} + #{$cordova-statusbar-padding});
  38. min-height: calc(#{$toolbar-height} + constant(safe-area-inset-top));
  39. min-height: calc(#{$toolbar-height} + env(safe-area-inset-top));
  40. }
  41. > ion-content.statusbar-padding:first-child .scroll-content {
  42. @include padding($cordova-statusbar-padding, null, null, null);
  43. @include padding(constant(safe-area-inset-top), null, null, null);
  44. @include padding(env(safe-area-inset-top), null, null, null);
  45. }
  46. > ion-content.statusbar-padding:first-child[padding] .scroll-content,
  47. > ion-content.statusbar-padding:first-child[padding-top] .scroll-content {
  48. @include padding(calc(#{$content-padding} + #{$cordova-statusbar-padding}), null, null, null);
  49. @include padding(constant(safe-area-inset-top), null, null, null);
  50. @include padding(env(safe-area-inset-top), null, null, null);
  51. }
  52. }
  53. // iOS is the only mode that uses this mixin and it should be removed with #5036
  54. // --------------------------------------------------------------------------------
  55. @mixin toolbar-title-statusbar-padding($toolbar-height, $toolbar-padding, $content-padding, $cordova-statusbar-padding) {
  56. > .toolbar.statusbar-padding:first-child ion-segment,
  57. > .toolbar.statusbar-padding:first-child ion-title {
  58. @include padding($cordova-statusbar-padding, null, null, null);
  59. @include padding(constant(safe-area-inset-top), null, null, null);
  60. @include padding(env(safe-area-inset-top), null, null, null);
  61. height: calc(#{$toolbar-height} + #{$cordova-statusbar-padding});
  62. height: calc(#{$toolbar-height} + constant(safe-area-inset-top));
  63. height: calc(#{$toolbar-height} + env(safe-area-inset-top));
  64. min-height: calc(#{$toolbar-height} + #{$cordova-statusbar-padding});
  65. min-height: calc(#{$toolbar-height} + constant(safe-area-inset-top));
  66. min-height: calc(#{$toolbar-height} + env(safe-area-inset-top));
  67. }
  68. }
  69. @mixin footer-safe-area($toolbar-height, $toolbar-padding) {
  70. .tabs:not(.tabs-ios[tabsPlacement=top]) .tabbar {
  71. @include padding(null, null, constant(safe-area-inset-bottom), null);
  72. @include padding(null, null, env(safe-area-inset-bottom), null);
  73. }
  74. ion-footer .toolbar:last-child {
  75. @include padding(null, null, calc(constant(safe-area-inset-bottom) + #{$toolbar-padding}), null);
  76. @include padding(null, null, calc(env(safe-area-inset-bottom) + #{$toolbar-padding}), null);
  77. min-height: calc(#{$toolbar-height} + constant(safe-area-inset-bottom));
  78. min-height: calc(#{$toolbar-height} + env(safe-area-inset-bottom));
  79. }
  80. }