From d9fa3fd7971b5331b6582b46b568048458bb5544 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Wed, 26 Oct 2016 18:33:58 -0700 Subject: [PATCH] Rename .tag to .badge to avoid conflicting with WordPress --- docs/_data/nav.yml | 2 +- docs/components/badge.md | 50 ++++++++++++++++++++++++++ docs/components/list-group.md | 6 ++-- docs/components/tag.md | 50 -------------------------- scss/{_tags.scss => _badge.scss} | 48 ++++++++++++------------- scss/_mixins.scss | 2 +- scss/_variables.scss | 28 +++++++-------- scss/bootstrap.scss | 2 +- scss/mixins/{_tag.scss => _badge.scss} | 2 +- 9 files changed, 95 insertions(+), 95 deletions(-) create mode 100644 docs/components/badge.md delete mode 100644 docs/components/tag.md rename scss/{_tags.scss => _badge.scss} (52%) rename scss/mixins/{_tag.scss => _badge.scss} (81%) diff --git a/docs/_data/nav.yml b/docs/_data/nav.yml index f89a136f8c..8473754226 100644 --- a/docs/_data/nav.yml +++ b/docs/_data/nav.yml @@ -31,6 +31,7 @@ - title: Components pages: - title: Alerts + - title: Badge - title: Breadcrumb - title: Buttons - title: Button group @@ -49,7 +50,6 @@ - title: Popovers - title: Progress - title: Scrollspy - - title: Tag - title: Tooltips - title: Utilities diff --git a/docs/components/badge.md b/docs/components/badge.md new file mode 100644 index 0000000000..71b550f3b6 --- /dev/null +++ b/docs/components/badge.md @@ -0,0 +1,50 @@ +--- +layout: docs +title: Badges +description: Documentation and examples for badges, our small count and labelling component. +group: components +--- + +Small and adaptive tag for adding context to just about any content. + +## Example + +Badges scale to match the size of the immediate parent element by using relative font sizing and `em` units. + +{% example html %} +

Example heading New

+

Example heading New

+

Example heading New

+

Example heading New

+
Example heading New
+
Example heading New
+{% endexample %} + +## Contextual variations + +Add any of the below mentioned modifier classes to change the appearance of a badge. + +{% example html %} +Default +Primary +Success +Info +Warning +Danger +{% endexample %} + +{% capture callout-include %}{% include callout-warning-color-assistive-technologies.md %}{% endcapture %} +{{ callout-include | markdownify }} + +## Pill badges + +Use the `.badge-pill` modifier class to make badges more rounded (with a larger `border-radius` and additional horizontal `padding`). Useful if you miss the badges from v3. + +{% example html %} +Default +Primary +Success +Info +Warning +Danger +{% endexample %} diff --git a/docs/components/list-group.md b/docs/components/list-group.md index 22982d1b95..a043474558 100644 --- a/docs/components/list-group.md +++ b/docs/components/list-group.md @@ -32,15 +32,15 @@ Add tags to any list group item to show unread counts, activity, etc. {% example html %} diff --git a/docs/components/tag.md b/docs/components/tag.md deleted file mode 100644 index d292cad227..0000000000 --- a/docs/components/tag.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -layout: docs -title: Tags -description: Documentation and examples for tags, our small label-badge component. -group: components ---- - -Small and adaptive tag for adding context to just about any content. - -## Example - -Tags scale to match the size of the immediate parent element by using relative font sizing and `em` units. - -{% example html %} -

Example heading New

-

Example heading New

-

Example heading New

-

Example heading New

-
Example heading New
-
Example heading New
-{% endexample %} - -## Contextual variations - -Add any of the below mentioned modifier classes to change the appearance of a tag. - -{% example html %} -Default -Primary -Success -Info -Warning -Danger -{% endexample %} - -{% capture callout-include %}{% include callout-warning-color-assistive-technologies.md %}{% endcapture %} -{{ callout-include | markdownify }} - -## Pill tags - -Use the `.tag-pill` modifier class to make tags more rounded (with a larger `border-radius` and additional horizontal `padding`). Useful if you miss the badges from v3. - -{% example html %} -Default -Primary -Success -Info -Warning -Danger -{% endexample %} diff --git a/scss/_tags.scss b/scss/_badge.scss similarity index 52% rename from scss/_tags.scss rename to scss/_badge.scss index dee9ed95d2..39635fcc76 100644 --- a/scss/_tags.scss +++ b/scss/_badge.scss @@ -3,13 +3,13 @@ // Requires one of the contextual, color modifier classes for `color` and // `background-color`. -.tag { +.badge { display: inline-block; - padding: $tag-padding-y $tag-padding-x; - font-size: $tag-font-size; - font-weight: $tag-font-weight; + padding: $badge-padding-y $badge-padding-x; + font-size: $badge-font-size; + font-weight: $badge-font-weight; line-height: 1; - color: $tag-color; + color: $badge-color; text-align: center; white-space: nowrap; vertical-align: baseline; @@ -22,16 +22,16 @@ } // Quick fix for tags in buttons -.btn .tag { +.btn .badge { position: relative; top: -1px; } // scss-lint:disable QualifyingElement // Add hover effects, but only for links -a.tag { +a.badge { @include hover-focus { - color: $tag-link-hover-color; + color: $badge-link-hover-color; text-decoration: none; cursor: pointer; } @@ -42,36 +42,36 @@ a.tag { // // Make them extra rounded with a modifier to replace v3's badges. -.tag-pill { - padding-right: $tag-pill-padding-x; - padding-left: $tag-pill-padding-x; - @include border-radius($tag-pill-border-radius); +.badge-pill { + padding-right: $badge-pill-padding-x; + padding-left: $badge-pill-padding-x; + @include border-radius($badge-pill-border-radius); } // Colors // // Contextual variations (linked tags get darker on :hover). -.tag-default { - @include tag-variant($tag-default-bg); +.badge-default { + @include badge-variant($badge-default-bg); } -.tag-primary { - @include tag-variant($tag-primary-bg); +.badge-primary { + @include badge-variant($badge-primary-bg); } -.tag-success { - @include tag-variant($tag-success-bg); +.badge-success { + @include badge-variant($badge-success-bg); } -.tag-info { - @include tag-variant($tag-info-bg); +.badge-info { + @include badge-variant($badge-info-bg); } -.tag-warning { - @include tag-variant($tag-warning-bg); +.badge-warning { + @include badge-variant($badge-warning-bg); } -.tag-danger { - @include tag-variant($tag-danger-bg); +.badge-danger { + @include badge-variant($badge-danger-bg); } diff --git a/scss/_mixins.scss b/scss/_mixins.scss index e53ab34148..8c2b9290ea 100644 --- a/scss/_mixins.scss +++ b/scss/_mixins.scss @@ -18,7 +18,7 @@ @import "mixins/breakpoints"; @import "mixins/hover"; @import "mixins/image"; -@import "mixins/tag"; +@import "mixins/badge"; @import "mixins/reset-filter"; @import "mixins/resize"; @import "mixins/screen-reader"; diff --git a/scss/_variables.scss b/scss/_variables.scss index 73a16b8a0e..7514207956 100644 --- a/scss/_variables.scss +++ b/scss/_variables.scss @@ -677,24 +677,24 @@ $popover-arrow-outer-color: fade-in($popover-border-color, .05) !defau // Tags -$tag-default-bg: $gray-light !default; -$tag-primary-bg: $brand-primary !default; -$tag-success-bg: $brand-success !default; -$tag-info-bg: $brand-info !default; -$tag-warning-bg: $brand-warning !default; -$tag-danger-bg: $brand-danger !default; +$badge-default-bg: $gray-light !default; +$badge-primary-bg: $brand-primary !default; +$badge-success-bg: $brand-success !default; +$badge-info-bg: $brand-info !default; +$badge-warning-bg: $brand-warning !default; +$badge-danger-bg: $brand-danger !default; -$tag-color: #fff !default; -$tag-link-hover-color: #fff !default; -$tag-font-size: 75% !default; -$tag-font-weight: $font-weight-bold !default; -$tag-padding-x: .4em !default; -$tag-padding-y: .25em !default; +$badge-color: #fff !default; +$badge-link-hover-color: #fff !default; +$badge-font-size: 75% !default; +$badge-font-weight: $font-weight-bold !default; +$badge-padding-x: .4em !default; +$badge-padding-y: .25em !default; -$tag-pill-padding-x: .6em !default; +$badge-pill-padding-x: .6em !default; // Use a higher than normal value to ensure completely rounded edges when // customizing padding or font-size on labels. -$tag-pill-border-radius: 10rem !default; +$badge-pill-border-radius: 10rem !default; // Modals diff --git a/scss/bootstrap.scss b/scss/bootstrap.scss index b2b63084b9..afcfb3268e 100644 --- a/scss/bootstrap.scss +++ b/scss/bootstrap.scss @@ -35,7 +35,7 @@ @import "card"; @import "breadcrumb"; @import "pagination"; -@import "tags"; +@import "badge"; @import "jumbotron"; @import "alert"; @import "progress"; diff --git a/scss/mixins/_tag.scss b/scss/mixins/_badge.scss similarity index 81% rename from scss/mixins/_tag.scss rename to scss/mixins/_badge.scss index 900c54e366..77206b9a5b 100644 --- a/scss/mixins/_tag.scss +++ b/scss/mixins/_badge.scss @@ -1,6 +1,6 @@ // Tags -@mixin tag-variant($color) { +@mixin badge-variant($color) { background-color: $color; &[href] {