From f7aa789d381cf261c836828efdb97b36b14fab15 Mon Sep 17 00:00:00 2001 From: James Benson Date: Wed, 6 Nov 2024 10:41:50 -0500 Subject: [PATCH 01/17] Add badge-icon --- css/src/components/badge.scss | 33 +++++++++++++++++++++++-- site/src/components/badge.md | 45 ++++++++++++++++++++++++++++++++++- 2 files changed, 75 insertions(+), 3 deletions(-) diff --git a/css/src/components/badge.scss b/css/src/components/badge.scss index 016eb3abd..c2f16f072 100644 --- a/css/src/components/badge.scss +++ b/css/src/components/badge.scss @@ -8,7 +8,12 @@ $badge-font-size-sm: $font-size-9 !default; $badge-font-size-lg: $font-size-7 !default; $badge-font-weight: $weight-semibold !default; -$badge-icon-font-size: 0.875em !default; +$badge-icon-font-size-xs: $font-size-4 !default; +$badge-icon-font-size: $font-size-2 !default; +$badge-icon-font-size-sm: $font-size-3 !default; +$badge-icon-font-size-lg: $font-size-1 !default; + +$badge-with-icon-font-size: 0.875em !default; $badge-border-width: $border-width !default; $badge-border-radius: $border-radius-rounded !default; @@ -71,8 +76,32 @@ $badge-border-radius: $border-radius-rounded !default; } } - .icon { + &.badge-icon { font-size: $badge-icon-font-size; + border-radius: 50%; + padding: 0; + } + + &.badge-icon-xs { + font-size: $badge-icon-font-size-xs; + border-radius: 50%; + padding: 0; + } + + &.badge-icon-sm { + font-size: $badge-icon-font-size-sm; + border-radius: 50%; + padding: 0; + } + + &.badge-icon-lg { + font-size: $badge-icon-font-size-lg; + border-radius: 50%; + padding: 0; + } + + .icon { + font-size: $badge-with-icon-font-size; } // Sizes diff --git a/site/src/components/badge.md b/site/src/components/badge.md index 9a689ccf1..bf68b1290 100644 --- a/site/src/components/badge.md +++ b/site/src/components/badge.md @@ -45,7 +45,7 @@ By default, badges are secondary badges. ### Badge with icon -Badges can include icons. To do this, nest the [icon component](./icon.md) inside a badge. +Badges can include icons and text. To do this, nest the [icon component](./icon.md) inside a badge. ```html @@ -59,3 +59,46 @@ Badges can include icons. To do this, nest the [icon component](./icon.md) insid Badge ``` + +### Badge Icon + +Badges with only icons. To do this, nest the [icon component](./icon.md) inside a badge. + +```html + + + + + + + + + + + + +``` From 6a35c12e371858e5ce8316b87a359121bb468a81 Mon Sep 17 00:00:00 2001 From: James Benson Date: Wed, 6 Nov 2024 12:12:17 -0500 Subject: [PATCH 02/17] add changeset --- .changeset/large-buttons-ring.md | 6 ++++++ css/src/components/badge.scss | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 .changeset/large-buttons-ring.md diff --git a/.changeset/large-buttons-ring.md b/.changeset/large-buttons-ring.md new file mode 100644 index 000000000..2e03e5d51 --- /dev/null +++ b/.changeset/large-buttons-ring.md @@ -0,0 +1,6 @@ +--- +'@microsoft/atlas-site': patch +'@microsoft/atlas-css': patch +--- + +Add badge-icon css styles diff --git a/css/src/components/badge.scss b/css/src/components/badge.scss index c2f16f072..130030b19 100644 --- a/css/src/components/badge.scss +++ b/css/src/components/badge.scss @@ -8,10 +8,10 @@ $badge-font-size-sm: $font-size-9 !default; $badge-font-size-lg: $font-size-7 !default; $badge-font-weight: $weight-semibold !default; -$badge-icon-font-size-xs: $font-size-4 !default; -$badge-icon-font-size: $font-size-2 !default; -$badge-icon-font-size-sm: $font-size-3 !default; -$badge-icon-font-size-lg: $font-size-1 !default; +$badge-icon-font-size-xs: 2.5em !default; +$badge-icon-font-size-sm: 3.5em !default; +$badge-icon-font-size: 4.5em !default; +$badge-icon-font-size-lg: 5.5em !default; $badge-with-icon-font-size: 0.875em !default; From 279f1c69045d02f769743b770c303b79831d771c Mon Sep 17 00:00:00 2001 From: James Benson Date: Wed, 6 Nov 2024 12:15:05 -0500 Subject: [PATCH 03/17] fix linting --- css/src/components/badge.scss | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/css/src/components/badge.scss b/css/src/components/badge.scss index 130030b19..5f26e26d3 100644 --- a/css/src/components/badge.scss +++ b/css/src/components/badge.scss @@ -77,27 +77,27 @@ $badge-border-radius: $border-radius-rounded !default; } &.badge-icon { - font-size: $badge-icon-font-size; - border-radius: 50%; padding: 0; + border-radius: 50%; + font-size: $badge-icon-font-size; } &.badge-icon-xs { - font-size: $badge-icon-font-size-xs; - border-radius: 50%; padding: 0; + border-radius: 50%; + font-size: $badge-icon-font-size-xs; } &.badge-icon-sm { - font-size: $badge-icon-font-size-sm; - border-radius: 50%; padding: 0; + border-radius: 50%; + font-size: $badge-icon-font-size-sm; } &.badge-icon-lg { - font-size: $badge-icon-font-size-lg; - border-radius: 50%; padding: 0; + border-radius: 50%; + font-size: $badge-icon-font-size-lg; } .icon { From a05f20531206d7625a818bcd135f1137994901b0 Mon Sep 17 00:00:00 2001 From: James Benson Date: Wed, 6 Nov 2024 12:41:47 -0500 Subject: [PATCH 04/17] default no border --- css/src/components/badge.scss | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/css/src/components/badge.scss b/css/src/components/badge.scss index 5f26e26d3..23ae68ca3 100644 --- a/css/src/components/badge.scss +++ b/css/src/components/badge.scss @@ -78,25 +78,25 @@ $badge-border-radius: $border-radius-rounded !default; &.badge-icon { padding: 0; - border-radius: 50%; + border: none; font-size: $badge-icon-font-size; } &.badge-icon-xs { padding: 0; - border-radius: 50%; + border: none; font-size: $badge-icon-font-size-xs; } &.badge-icon-sm { padding: 0; - border-radius: 50%; + border: none; font-size: $badge-icon-font-size-sm; } &.badge-icon-lg { padding: 0; - border-radius: 50%; + border: none; font-size: $badge-icon-font-size-lg; } From 7b24f1d72a728afde5eee699b3a5ae182c77607c Mon Sep 17 00:00:00 2001 From: James Benson Date: Fri, 8 Nov 2024 08:45:25 -0500 Subject: [PATCH 05/17] updated styles and description --- css/src/components/badge.scss | 40 +++++++++++++++-------------------- site/src/components/badge.md | 37 ++++++++++++++++++-------------- 2 files changed, 38 insertions(+), 39 deletions(-) diff --git a/css/src/components/badge.scss b/css/src/components/badge.scss index 23ae68ca3..1c35d0947 100644 --- a/css/src/components/badge.scss +++ b/css/src/components/badge.scss @@ -8,10 +8,10 @@ $badge-font-size-sm: $font-size-9 !default; $badge-font-size-lg: $font-size-7 !default; $badge-font-weight: $weight-semibold !default; -$badge-icon-font-size-xs: 2.5em !default; -$badge-icon-font-size-sm: 3.5em !default; -$badge-icon-font-size: 4.5em !default; -$badge-icon-font-size-lg: 5.5em !default; +$badge-icon-font-size-xs: 1.5em !default; +$badge-icon-font-size-sm: 2.5em !default; +$badge-icon-font-size: 3.5em !default; +$badge-icon-font-size-lg: 4.5em !default; $badge-with-icon-font-size: 0.875em !default; @@ -76,28 +76,23 @@ $badge-border-radius: $border-radius-rounded !default; } } - &.badge-icon { + &:has(.icon:only-child) { padding: 0; border: none; - font-size: $badge-icon-font-size; - } - - &.badge-icon-xs { - padding: 0; - border: none; - font-size: $badge-icon-font-size-xs; - } - &.badge-icon-sm { - padding: 0; - border: none; - font-size: $badge-icon-font-size-sm; - } + .icon { + font-size: $badge-icon-font-size; - &.badge-icon-lg { - padding: 0; - border: none; - font-size: $badge-icon-font-size-lg; + &.icon-xs { + font-size: $badge-icon-font-size-xs; + } + &.icon-sm { + font-size: $badge-icon-font-size-sm; + } + &.icon-lg { + font-size: $badge-icon-font-size-lg; + } + } } .icon { @@ -105,7 +100,6 @@ $badge-border-radius: $border-radius-rounded !default; } // Sizes - &.badge-sm { font-size: $badge-font-size-sm; } diff --git a/site/src/components/badge.md b/site/src/components/badge.md index bf68b1290..59f3d41d1 100644 --- a/site/src/components/badge.md +++ b/site/src/components/badge.md @@ -62,43 +62,48 @@ Badges can include icons and text. To do this, nest the [icon component](./icon. ### Badge Icon -Badges with only icons. To do this, nest the [icon component](./icon.md) inside a badge. +Badges with only icons. To do this, the following classes are available for resizing: `icon-xs`, `icon-sm`, `icon-lg`. ```html - -