_modals.scss 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. $zindex-modal-background: 500;
  2. .fade {
  3. @include transition(opacity 0.15s linear);
  4. opacity: 0;
  5. &.in {
  6. opacity: 1;
  7. }
  8. }
  9. // Kill the scroll on the body
  10. .modal-open {
  11. overflow: hidden;
  12. .content-wrapper {
  13. transform: none;
  14. }
  15. }
  16. // Container that the modal scrolls within
  17. .modal {
  18. display: none;
  19. overflow: auto;
  20. overflow-y: scroll;
  21. position: fixed;
  22. top: 0;
  23. inset-inline-end: 0;
  24. bottom: 0;
  25. inset-inline-start: 0;
  26. z-index: $zindex-modal-background;
  27. }
  28. // Shell div to position the modal with bottom padding
  29. .modal-dialog {
  30. margin-inline-start: auto;
  31. margin-inline-end: auto;
  32. padding: 0;
  33. z-index: ($zindex-modal-background + 10);
  34. height: 90%;
  35. width: 85%;
  36. &:before {
  37. content: '';
  38. display: inline-block;
  39. height: 100%;
  40. vertical-align: middle;
  41. margin-inline-end: -0.25em;
  42. }
  43. }
  44. // Actual modal
  45. .modal-content {
  46. border-radius: 3px;
  47. width: 98.7%;
  48. position: relative;
  49. background-color: theme('colors.surface-page');
  50. margin-top: 2em;
  51. padding-bottom: 3em;
  52. display: inline-block;
  53. vertical-align: middle;
  54. overflow: hidden;
  55. }
  56. // Modal background
  57. .modal-backdrop {
  58. position: fixed;
  59. top: 0;
  60. inset-inline-end: 0;
  61. bottom: 0;
  62. inset-inline-start: 0;
  63. z-index: ($zindex-modal-background - 10);
  64. background-color: theme('colors.black-50');
  65. // Fade for backdrop
  66. &.fade {
  67. opacity: 0;
  68. }
  69. &.in {
  70. opacity: 1;
  71. }
  72. }
  73. .modal .close.button {
  74. position: absolute;
  75. display: inline-flex;
  76. justify-content: center;
  77. align-items: center;
  78. background-color: transparent;
  79. padding: 0;
  80. top: theme('spacing.3');
  81. inset-inline-end: theme('spacing.3');
  82. width: theme('spacing.8');
  83. height: theme('spacing.8');
  84. color: theme('colors.text-button');
  85. z-index: 1;
  86. &:hover {
  87. background-color: theme('colors.surface-menu-item-active');
  88. color: theme('colors.text-button');
  89. }
  90. }
  91. // Where all modal content resides
  92. .modal-body {
  93. position: relative;
  94. padding-bottom: 2em;
  95. .w-header {
  96. color: theme('colors.text-label-menus-default');
  97. background-color: theme('colors.surface-menus');
  98. > .row {
  99. // reset inline padding added to w-header for sidebar offset
  100. padding-inline-start: theme('spacing.16');
  101. // ensure title can never overlap the close button
  102. padding-inline-end: theme('spacing.16');
  103. }
  104. .w-header__title {
  105. color: inherit;
  106. font-weight: 700;
  107. font-size: theme('fontSize.19');
  108. line-height: 130%;
  109. }
  110. }
  111. }
  112. @include media-breakpoint-up(sm) {
  113. .modal-dialog {
  114. margin-inline-end: theme('spacing.20');
  115. margin-inline-start: theme('spacing.20');
  116. padding: 0 0 2em 0;
  117. width: auto;
  118. }
  119. .modal .close.button {
  120. width: theme('spacing.12');
  121. height: theme('spacing.12');
  122. }
  123. }
  124. @include media-breakpoint-up(xl) {
  125. .modal-dialog {
  126. margin-inline-end: auto;
  127. margin-inline-start: auto;
  128. max-width: 100em;
  129. padding: 0 0 2em;
  130. }
  131. }