assets/stylesheets/bootstrap/_modal.scss in bootstrap-4.0.0.alpha5 vs assets/stylesheets/bootstrap/_modal.scss in bootstrap-4.0.0.alpha6

- old
+ new

@@ -26,14 +26,14 @@ // gnarly iOS Safari bug: https://bugs.webkit.org/show_bug.cgi?id=158342 // See also https://github.com/twbs/bootstrap/issues/17695 // When fading in the modal, animate it to slide down &.fade .modal-dialog { - transition: transform .3s ease-out; + @include transition($modal-transition); transform: translate(0, -25%); } - &.in .modal-dialog { transform: translate(0, 0); } + &.show .modal-dialog { transform: translate(0, 0); } } .modal-open .modal { overflow-x: hidden; overflow-y: auto; } @@ -46,10 +46,12 @@ } // Actual modal .modal-content { position: relative; + display: flex; + flex-direction: column; background-color: $modal-content-bg; background-clip: padding-box; border: $modal-content-border-width solid $modal-content-border-color; @include border-radius($border-radius-lg); @include box-shadow($modal-content-xs-box-shadow); @@ -62,48 +64,54 @@ position: fixed; top: 0; right: 0; bottom: 0; left: 0; - z-index: $zindex-modal-bg; + z-index: $zindex-modal-backdrop; background-color: $modal-backdrop-bg; // Fade for backdrop &.fade { opacity: 0; } - &.in { opacity: $modal-backdrop-opacity; } + &.show { opacity: $modal-backdrop-opacity; } } // Modal header // Top section of the modal w/ title and dismiss .modal-header { - padding: $modal-title-padding; + display: flex; + align-items: center; // vertically center it + justify-content: space-between; // Put modal header elements (title and dismiss) on opposite ends + padding: $modal-header-padding; border-bottom: $modal-header-border-width solid $modal-header-border-color; - @include clearfix; } -// Close icon -.modal-header .close { - margin-top: -2px; -} // Title text within header .modal-title { - margin: 0; + margin-bottom: 0; line-height: $modal-title-line-height; } // Modal body // Where all modal content resides (sibling of .modal-header and .modal-footer) .modal-body { position: relative; + // Enable `flex-grow: 1` so that the body take up as much space as possible + // when should there be a fixed height on `.modal-dialog`. + flex: 1 1 auto; padding: $modal-inner-padding; } // Footer (for actions) .modal-footer { + display: flex; + align-items: center; // vertically center + justify-content: flex-end; // Right align buttons with flex property because text-align doesn't work on flex items padding: $modal-inner-padding; - text-align: right; // right align buttons border-top: $modal-footer-border-width solid $modal-footer-border-color; - @include clearfix(); // clear it in case folks use .pull-* classes on buttons + + // Easily place margin between footer elements + > :not(:first-child) { margin-left: .25rem; } + > :not(:last-child) { margin-right: .25rem; } } // Measure scrollbar width for padding body during modal show/hide .modal-scrollbar-measure { position: absolute;