2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-08 17:22:31 +03:00

Contextual list group cleanup

* Adds nav link to sidebar for contextual classes
* Refactors to use prefixed classes, like .list-group-item-info, instead of chained classes
* Adds default and linked variations to example in docs
This commit is contained in:
Mark Otto
2013-12-07 14:09:03 -08:00
parent 693915d127
commit 07de53c644
7 changed files with 181 additions and 57 deletions
+23 -6
View File
@@ -2,17 +2,21 @@
// List groups
// --------------------------------------------------
// Base class
//
// Easily usable on <ul>, <ol>, or <div>.
.list-group {
// No need to set list-style: none; since .list-group-item is block level
margin-bottom: 20px;
padding-left: 0; // reset padding because ul and ol
}
// Individual list items
// -------------------------
//
// Use on `li`s or `div`s within the `.list-group` parent.
.list-group-item {
position: relative;
@@ -41,12 +45,12 @@
}
}
// Contextual variants
.list-group-item-variant(success; @state-success-bg; @state-success-border);
.list-group-item-variant(danger; @state-danger-bg; @state-danger-border);
.list-group-item-variant(warning; @state-warning-bg; @state-warning-border);
// Linked list items
//
// Use anchor elements instead of `li`s or `div`s to create linked list items.
// Includes an extra `.active` modifier class for showing selected items.
a.list-group-item {
color: @list-group-link-color;
@@ -80,8 +84,21 @@ a.list-group-item {
}
}
// Contextual variants
//
// Add modifier classes to change text and background color on individual items.
// Organizationally, this must come after the `:hover` states.
.list-group-item-variant(success; @state-success-bg; @state-success-text);
.list-group-item-variant(warning; @state-warning-bg; @state-warning-text);
.list-group-item-variant(danger; @state-danger-bg; @state-danger-text);
.list-group-item-variant(info; @state-info-bg; @state-info-text);
// Custom content options
// -------------------------
//
// Extra classes for creating well-formatted content within `.list-group-item`s.
.list-group-item-heading {
margin-top: 0;
+19 -7
View File
@@ -450,16 +450,28 @@
// List Groups
// -------------------------
.list-group-item-variant(@state; @background; @border) {
.list-group-item.@{state} {
.list-group-item-variant(@state; @background; @color) {
.list-group-item-@{state} {
color: @color;
background-color: @background;
border-color: @border;
}
a.list-group-item-@{state} {
color: @color;
// Hover states
.list-group-item.@{state}:hover {
background-color: darken(@background, 5%);
border-color: darken(@border, 5%);
.list-group-item-heading { color: inherit; }
&:hover,
&:focus {
color: @color;
background-color: darken(@background, 5%);
}
&.active,
&.active:hover,
&.active:focus {
color: #fff;
background-color: @color;
border-color: @color;
}
}
}