modals.less 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. //
  2. // Modals
  3. // --------------------------------------------------
  4. // .modal-open - body class for killing the scroll
  5. // .modal - container to scroll within
  6. // .modal-dialog - positioning shell for the actual modal
  7. // .modal-content - actual modal w/ bg and corners and shit
  8. // Kill the scroll on the body
  9. .modal-open {
  10. overflow: hidden;
  11. }
  12. // Container that the modal scrolls within
  13. .modal {
  14. display: none;
  15. overflow: auto;
  16. overflow-y: scroll;
  17. position: fixed;
  18. top: 0;
  19. right: 0;
  20. bottom: 0;
  21. left: 0;
  22. z-index: @zindex-modal;
  23. -webkit-overflow-scrolling: touch;
  24. // Prevent Chrome on Windows from adding a focus outline. For details, see
  25. // https://github.com/twbs/bootstrap/pull/10951.
  26. outline: 0;
  27. // When fading in the modal, animate it to slide down
  28. &.fade .modal-dialog {
  29. .translate(0, -25%);
  30. .transition-transform(~'0.3s ease-out');
  31. }
  32. &.in .modal-dialog {
  33. // prettier-ignore
  34. .translate(0, 0);
  35. }
  36. }
  37. // Shell div to position the modal with bottom padding
  38. .modal-dialog {
  39. position: relative;
  40. width: auto;
  41. margin: 10px;
  42. }
  43. // Actual modal
  44. .modal-content {
  45. position: relative;
  46. background-color: @modal-content-bg;
  47. border: 1px solid @modal-content-fallback-border-color; //old browsers fallback (ie8 etc)
  48. border: 1px solid @modal-content-border-color;
  49. border-radius: @border-radius-large;
  50. .box-shadow(0 3px 9px rgba(0, 0, 0, 0.5));
  51. background-clip: padding-box;
  52. // Remove focus outline from opened modal
  53. outline: none;
  54. }
  55. // Modal background
  56. .modal-backdrop {
  57. position: fixed;
  58. top: 0;
  59. right: 0;
  60. bottom: 0;
  61. left: 0;
  62. z-index: @zindex-modal-background;
  63. background-color: @modal-backdrop-bg;
  64. // Fade for backdrop
  65. &.fade {
  66. .opacity(0);
  67. }
  68. &.in {
  69. .opacity(@modal-backdrop-opacity);
  70. }
  71. }
  72. // Modal header
  73. // Top section of the modal w/ title and dismiss
  74. .modal-header {
  75. padding: @modal-title-padding;
  76. border-bottom: 1px solid @modal-header-border-color;
  77. min-height: (@modal-title-padding + @modal-title-line-height);
  78. }
  79. // Close icon
  80. .modal-header .close {
  81. margin-top: -2px;
  82. }
  83. .modal-header {
  84. h1,
  85. h2,
  86. h3,
  87. h4,
  88. h5 {
  89. margin: 0;
  90. font-family: @font-family-sans-serif;
  91. font-weight: 700;
  92. }
  93. }
  94. // Title text within header
  95. .modal-title {
  96. margin: 0;
  97. line-height: @modal-title-line-height;
  98. }
  99. // Modal body
  100. // Where all modal content resides (sibling of .modal-header and .modal-footer)
  101. .modal-body {
  102. position: relative;
  103. padding: @modal-inner-padding;
  104. }
  105. // Footer (for actions)
  106. .modal-footer {
  107. //margin-top: 15px;
  108. padding: (@modal-inner-padding - 1) @modal-inner-padding @modal-inner-padding;
  109. text-align: right; // right align buttons
  110. border-top: 1px solid @modal-footer-border-color;
  111. background-color: @modal-footer-background-color;
  112. border-radius: 0 0 @border-radius-large @border-radius-large;
  113. &:extend(.clearfix
  114. all); // clear it in case folks use .pull-* classes on buttons
  115. // Properly space out buttons
  116. .btn + .btn {
  117. margin-left: 5px;
  118. margin-bottom: 0; // account for input[type="submit"] which gets the bottom margin like all other inputs
  119. }
  120. // but override that for button groups
  121. .btn-group .btn + .btn {
  122. margin-left: -1px;
  123. }
  124. // and override it for block buttons as well
  125. .btn-block + .btn-block {
  126. margin-left: 0;
  127. }
  128. .modal-footer-left {
  129. float: left;
  130. }
  131. }
  132. // Scale up the modal
  133. @media (min-width: @screen-sm-min) {
  134. // Automatically set modal's width for larger viewports
  135. .modal-dialog {
  136. width: @modal-md;
  137. margin: 30px auto;
  138. }
  139. .modal-content {
  140. .box-shadow(0 5px 15px rgba(0, 0, 0, 0.5));
  141. }
  142. // Modal sizes
  143. .modal-sm {
  144. width: @modal-sm;
  145. }
  146. }
  147. @media (min-width: @screen-md-min) {
  148. .modal-lg {
  149. width: @modal-lg;
  150. }
  151. }
  152. .website-redesign-modal {
  153. .modal-title {
  154. font-size: var(--font-size-05);
  155. line-height: var(--line-height-04);
  156. margin-bottom: var(--spacing-02);
  157. }
  158. .modal-subtitle {
  159. font-size: var(--font-size-03);
  160. line-height: var(--line-height-03);
  161. margin: 0;
  162. }
  163. .modal-body,
  164. .modal-footer {
  165. padding: var(--spacing-06);
  166. }
  167. .modal-header {
  168. border-bottom: 1px solid var(--neutral-20);
  169. }
  170. .modal-footer {
  171. border-top: 1px solid var(--neutral-20);
  172. background-color: transparent;
  173. p:last-child {
  174. margin-bottom: 0;
  175. }
  176. }
  177. .close {
  178. color: var(--neutral-90);
  179. font-size: var(--font-size-05);
  180. line-height: var(--line-height-02);
  181. opacity: 1;
  182. height: 36px;
  183. width: 36px;
  184. padding: var(--spacing-04);
  185. &:hover {
  186. background-color: var(--neutral-10);
  187. border-radius: 50%;
  188. }
  189. }
  190. }