0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-01-17 09:52:29 +01:00

Refactor pagination code to remove unnecessary ancestor requirements in selectors

This commit is contained in:
Chris Rebert 2015-10-29 22:24:25 -07:00
parent 5f35ce2095
commit 0c1df9912f
2 changed files with 41 additions and 43 deletions

View File

@ -4,43 +4,24 @@
margin-top: $spacer-y;
margin-bottom: $spacer-y;
@include border-radius();
}
.page {
display: inline; // Remove list-style and block-level defaults
.page {
display: inline; // Remove list-style and block-level defaults
&:first-child {
.page-link {
position: relative;
float: left; // Collapse white-space
padding: $pagination-padding-y $pagination-padding-x;
margin-left: -1px;
line-height: $line-height;
color: $pagination-color;
text-decoration: none;
background-color: $pagination-bg;
border: $pagination-border-width solid $pagination-border-color;
margin-left: 0;
@include border-left-radius($border-radius);
}
&:first-child {
.page-link {
margin-left: 0;
@include border-left-radius($border-radius);
}
}
&:last-child {
.page-link {
@include border-right-radius($border-radius);
}
}
&:last-child {
.page-link {
@include border-right-radius($border-radius);
}
}
.page .page-link {
@include hover-focus {
color: $pagination-hover-color;
background-color: $pagination-hover-bg;
border-color: $pagination-hover-border;
}
}
.page.active .page-link {
&.active .page-link {
@include plain-hover-focus {
z-index: 2;
color: $pagination-active-color;
@ -50,18 +31,34 @@
}
}
.page.disabled {
.page-link {
@include plain-hover-focus {
color: $pagination-disabled-color;
cursor: $cursor-disabled;
background-color: $pagination-disabled-bg;
border-color: $pagination-disabled-border;
}
&.disabled .page-link {
@include plain-hover-focus {
color: $pagination-disabled-color;
cursor: $cursor-disabled;
background-color: $pagination-disabled-bg;
border-color: $pagination-disabled-border;
}
}
}
.page-link {
position: relative;
float: left; // Collapse white-space
padding: $pagination-padding-y $pagination-padding-x;
margin-left: -1px;
line-height: $line-height;
color: $pagination-color;
text-decoration: none;
background-color: $pagination-bg;
border: 1px solid $pagination-border;
@include hover-focus {
color: $pagination-hover-color;
background-color: $pagination-hover-bg;
border-color: $pagination-hover-border;
}
}
//
// Sizing

View File

@ -1,12 +1,13 @@
// Pagination
@mixin pagination-size($padding-vertical, $padding-horizontal, $font-size, $line-height, $border-radius) {
.page-link {
padding: $padding-vertical $padding-horizontal;
font-size: $font-size;
line-height: $line-height;
}
.page {
.page-link {
padding: $padding-vertical $padding-horizontal;
font-size: $font-size;
line-height: $line-height;
}
&:first-child {
.page-link {
@include border-left-radius($border-radius);