diff options
| author | Mark Otto <[email protected]> | 2013-12-07 14:09:03 -0800 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2013-12-07 14:09:03 -0800 |
| commit | 07de53c644b315852c5f315ab91bfd6d65660d50 (patch) | |
| tree | 2ce0972d5c8c19c67b7eb079e566223ef2ae2be1 /less | |
| parent | 693915d1277d465844c6757fc107110342229d76 (diff) | |
| download | bootstrap-07de53c644b315852c5f315ab91bfd6d65660d50.tar.xz bootstrap-07de53c644b315852c5f315ab91bfd6d65660d50.zip | |
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
Diffstat (limited to 'less')
| -rw-r--r-- | less/list-group.less | 29 | ||||
| -rw-r--r-- | less/mixins.less | 26 |
2 files changed, 42 insertions, 13 deletions
diff --git a/less/list-group.less b/less/list-group.less index cf4ce3eea..35fff05d4 100644 --- a/less/list-group.less +++ b/less/list-group.less @@ -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; diff --git a/less/mixins.less b/less/mixins.less index 04bd10ee0..9c84984ba 100644 --- a/less/mixins.less +++ b/less/mixins.less @@ -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; + } } } |
