Refactor a few selectors. (#24404)

1. move a couple of them before the more specific ones.
2. change nesting to be under the same parent selector
3. use the ampersand more
This commit is contained in:
XhmikosR 2017-10-23 00:17:28 +03:00 committed by GitHub
parent 29d58fb758
commit 52d99a887e
5 changed files with 151 additions and 134 deletions

View File

@ -5,10 +5,6 @@
// //
.bd-example-row { .bd-example-row {
.row + .row {
margin-top: 1rem;
}
.row { .row {
> .col, > .col,
> [class^="col-"] { > [class^="col-"] {
@ -19,6 +15,10 @@
} }
} }
.row + .row {
margin-top: 1rem;
}
.flex-items-top, .flex-items-top,
.flex-items-middle, .flex-items-middle,
.flex-items-bottom { .flex-items-bottom {
@ -170,31 +170,37 @@
> .form-group:last-child { > .form-group:last-child {
margin-bottom: 0; margin-bottom: 0;
} }
}
.bd-example > .close { > .close {
float: none; float: none;
} }
}
// Typography // Typography
.bd-example-type .table .type-info { .bd-example-type {
.table {
.type-info {
color: #999; color: #999;
vertical-align: middle; vertical-align: middle;
} }
.bd-example-type .table td { td {
padding: 1rem 0; padding: 1rem 0;
border-color: #eee; border-color: #eee;
} }
.bd-example-type .table tr:first-child td { tr:first-child td {
border-top: 0; border-top: 0;
} }
.bd-example-type h1, }
.bd-example-type h2,
.bd-example-type h3, h1,
.bd-example-type h4, h2,
.bd-example-type h5, h3,
.bd-example-type h6 { h4,
margin: 0; h5,
h6 {
margin-top: 0;
margin-bottom: 0;
}
} }
// Contextual background colors // Contextual background colors
@ -210,13 +216,15 @@
} }
// Buttons // Buttons
.bd-example > .btn-group { .bd-example {
> .btn-group {
margin-top: .25rem; margin-top: .25rem;
margin-bottom: .25rem; margin-bottom: .25rem;
} }
.bd-example > .btn-toolbar + .btn-toolbar { > .btn-toolbar + .btn-toolbar {
margin-top: .5rem; margin-top: .5rem;
} }
}
// Forms // Forms
.bd-example-control-sizing select, .bd-example-control-sizing select,
@ -265,6 +273,19 @@
} }
// Example modals // Example modals
.modal {
z-index: 1072;
.tooltip,
.popover {
z-index: 1073;
}
}
.modal-backdrop {
z-index: 1071;
}
.bd-example-modal { .bd-example-modal {
background-color: #fafafa; background-color: #fafafa;
@ -285,20 +306,6 @@
} }
} }
.modal {
z-index: 1072;
.tooltip,
.popover {
z-index: 1073;
}
}
.modal-backdrop {
z-index: 1071;
}
// Example tabbable tabs // Example tabbable tabs
.bd-example-tabs .nav-tabs { .bd-example-tabs .nav-tabs {
margin-bottom: 1rem; margin-bottom: 1rem;
@ -307,11 +314,12 @@
// Tooltips // Tooltips
.bd-example-tooltips { .bd-example-tooltips {
text-align: center; text-align: center;
}
.bd-example-tooltips > .btn { > .btn {
margin-top: .25rem; margin-top: .25rem;
margin-bottom: .25rem; margin-bottom: .25rem;
} }
}
.bs-tooltip-top-docs, .bs-tooltip-top-docs,
.bs-tooltip-bottom-docs { .bs-tooltip-bottom-docs {
.arrow { .arrow {
@ -329,14 +337,15 @@
.bd-example-popover-static { .bd-example-popover-static {
padding-bottom: 1.5rem; padding-bottom: 1.5rem;
background-color: #f9f9f9; background-color: #f9f9f9;
}
.bd-example-popover-static .popover { .popover {
position: relative; position: relative;
display: block; display: block;
float: left; float: left;
width: 260px; width: 260px;
margin: 1.25rem; margin: 1.25rem;
} }
}
.bs-popover-top-docs, .bs-popover-top-docs,
.bs-popover-bottom-docs { .bs-popover-bottom-docs {
.arrow { .arrow {
@ -413,14 +422,16 @@
} }
} }
.highlight pre { .highlight {
pre {
padding: 0; padding: 0;
margin-top: 0; margin-top: 0;
margin-bottom: 0; margin-bottom: 0;
background-color: transparent; background-color: transparent;
border: 0; border: 0;
} }
.highlight pre code { pre code {
font-size: inherit; font-size: inherit;
color: $gray-900; // Effectively the base text color color: $gray-900; // Effectively the base text color
} }
}

View File

@ -43,47 +43,50 @@
} }
} }
.btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) { .btn-group {
> .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) {
border-radius: 0; border-radius: 0;
} }
// Set corners individual because sometimes a single button can be in a .btn-group // Set corners individual because sometimes a single button can be in a .btn-group
// and we need :first-child and :last-child to both match // and we need :first-child and :last-child to both match
.btn-group > .btn:first-child { > .btn:first-child {
margin-left: 0; margin-left: 0;
&:not(:last-child):not(.dropdown-toggle) { &:not(:last-child):not(.dropdown-toggle) {
@include border-right-radius(0); @include border-right-radius(0);
} }
} }
// Need .dropdown-toggle since :last-child doesn't apply given a .dropdown-menu // Need .dropdown-toggle since :last-child doesn't apply given a .dropdown-menu
// immediately after it // immediately after it
.btn-group > .btn:last-child:not(:first-child), > .btn:last-child:not(:first-child),
.btn-group > .dropdown-toggle:not(:first-child) { > .dropdown-toggle:not(:first-child) {
@include border-left-radius(0); @include border-left-radius(0);
} }
// Custom edits for including btn-groups within btn-groups (useful for including // Custom edits for including btn-groups within btn-groups (useful for including
// dropdown buttons within a btn-group) // dropdown buttons within a btn-group)
.btn-group > .btn-group { > .btn-group {
float: left; float: left;
} }
.btn-group > .btn-group:not(:first-child):not(:last-child) > .btn { > .btn-group:not(:first-child):not(:last-child) > .btn {
border-radius: 0; border-radius: 0;
} }
.btn-group > .btn-group:first-child:not(:last-child) { > .btn-group:first-child:not(:last-child) {
> .btn:last-child, > .btn:last-child,
> .dropdown-toggle { > .dropdown-toggle {
@include border-right-radius(0); @include border-right-radius(0);
} }
} }
.btn-group > .btn-group:last-child:not(:first-child) > .btn:first-child { > .btn-group:last-child:not(:first-child) > .btn:first-child {
@include border-left-radius(0); @include border-left-radius(0);
} }
}
// Sizing // Sizing
// //

View File

@ -119,12 +119,12 @@ fieldset[disabled] a.btn {
.btn-block { .btn-block {
display: block; display: block;
width: 100%; width: 100%;
}
// Vertically space out multiple block buttons // Vertically space out multiple block buttons
.btn-block + .btn-block { + .btn-block {
margin-top: $btn-block-spacing-y; margin-top: $btn-block-spacing-y;
} }
}
// Specificity overrides // Specificity overrides
input[type="submit"], input[type="submit"],

View File

@ -26,17 +26,11 @@
// gnarly iOS Safari bug: https://bugs.webkit.org/show_bug.cgi?id=158342 // gnarly iOS Safari bug: https://bugs.webkit.org/show_bug.cgi?id=158342
// See also https://github.com/twbs/bootstrap/issues/17695 // See also https://github.com/twbs/bootstrap/issues/17695
// When fading in the modal, animate it to slide down .modal-open & {
&.fade .modal-dialog {
@include transition($modal-transition);
transform: translate(0, -25%);
}
&.show .modal-dialog { transform: translate(0, 0); }
}
.modal-open .modal {
overflow-x: hidden; overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
} }
}
// Shell div to position the modal with bottom padding // Shell div to position the modal with bottom padding
.modal-dialog { .modal-dialog {
@ -45,6 +39,15 @@
margin: $modal-dialog-margin; margin: $modal-dialog-margin;
// allow clicks to pass through for custom click handling to close modal // allow clicks to pass through for custom click handling to close modal
pointer-events: none; pointer-events: none;
// When fading in the modal, animate it to slide down
.modal.fade & {
@include transition($modal-transition);
transform: translate(0, -25%);
}
.modal.show & {
transform: translate(0, 0);
}
} }
// Actual modal // Actual modal

View File

@ -4,6 +4,24 @@
@include border-radius(); @include border-radius();
} }
.page-link {
position: relative;
display: block;
padding: $pagination-padding-y $pagination-padding-x;
margin-left: -$pagination-border-width;
line-height: $pagination-line-height;
color: $pagination-color;
background-color: $pagination-bg;
border: $pagination-border-width solid $pagination-border-color;
@include hover-focus {
color: $pagination-hover-color;
text-decoration: none;
background-color: $pagination-hover-bg;
border-color: $pagination-hover-border-color;
}
}
.page-item { .page-item {
&:first-child { &:first-child {
.page-link { .page-link {
@ -32,24 +50,6 @@
} }
} }
.page-link {
position: relative;
display: block;
padding: $pagination-padding-y $pagination-padding-x;
margin-left: -$pagination-border-width;
line-height: $pagination-line-height;
color: $pagination-color;
background-color: $pagination-bg;
border: $pagination-border-width solid $pagination-border-color;
@include hover-focus {
color: $pagination-hover-color;
text-decoration: none;
background-color: $pagination-hover-bg;
border-color: $pagination-hover-border-color;
}
}
// //
// Sizing // Sizing