_modals.scss 2.9 KB

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