diff --git a/cypress/e2e/badge.cy.js b/cypress/e2e/badge.cy.js
index 309c39ad8d0f3bcad41bbab664011c32f25828ce..364ada196062a916f8338d4ec153a4f20ca1e6d5 100644
--- a/cypress/e2e/badge.cy.js
+++ b/cypress/e2e/badge.cy.js
@@ -9,12 +9,6 @@ describe('GlBadge', () => {
});
}
- function checkA11yTextOnlyState() {
- cy.visitStory('base/badge', {
- story: 'sizes',
- });
- }
-
function checkA11yBadgeHoverState() {
cy.visitStory('base/badge', {
story: 'actionable',
@@ -41,7 +35,6 @@ describe('GlBadge', () => {
cy.glRunA11yTests({
checkA11YDefaultState,
checkA11yIconOnlyState,
- checkA11yTextOnlyState,
checkA11yBadgeHoverState,
checkA11yBadgeSelectedState,
checkA11yIconWithTextState,
diff --git a/src/components/base/avatar_labeled/avatar_labeled.stories.js b/src/components/base/avatar_labeled/avatar_labeled.stories.js
index 1cf39264c245cc8f2b528cc9f777865cbec122e2..3b6b321d19a8467d1cd43170a87b9d8408442166 100644
--- a/src/components/base/avatar_labeled/avatar_labeled.stories.js
+++ b/src/components/base/avatar_labeled/avatar_labeled.stories.js
@@ -102,10 +102,10 @@ export const WithBadges = (args, { argTypes }) => ({
>
- 2FA
+ 2FA
- Blocked
+ Blocked
diff --git a/src/components/base/badge/badge.scss b/src/components/base/badge/badge.scss
index 823365894e3f5405f0ad89b90ad0348640042801..fb97dc46cd862596c48bdf7c775e12327635975c 100644
--- a/src/components/base/badge/badge.scss
+++ b/src/components/base/badge/badge.scss
@@ -1,3 +1,6 @@
+$badge-padding-horizontal: 0.75 * $grid-size;
+$badge-min-width: 2.5 * $grid-size;
+
@mixin gl-badge-variant(
$variant,
$color,
@@ -15,7 +18,6 @@
color: $color;
.gl-badge-icon {
- color: $icon-color;
transition: inherit;
}
}
@@ -66,29 +68,18 @@
.gl-badge {
@include gl-display-inline-flex;
@include gl-align-items-center;
+ @include gl-justify-content-center;
@include gl-font-sm;
@include gl-font-weight-normal;
@include gl-line-height-normal;
- @include gl-py-2;
- @include gl-px-3;
+ gap: $gl-spacing-scale-2;
+ padding: $gl-spacing-scale-1 $badge-padding-horizontal;
+ min-width: $badge-min-width;
@media (forced-colors: active) {
border: 1px solid;
}
- &.sm {
- @include gl-py-0;
- }
-
- &.md {
- @include gl-py-2;
- }
-
- &.lg {
- @include gl-py-3;
- @include gl-font-base;
- }
-
.gl-badge-icon {
@include gl-h-5;
@include gl-w-5;
@@ -193,4 +184,11 @@
// overriding Bootstap's `.btn .badge {top: -1px}` as the badge is not vertically centered otherwise
.gl-button .gl-badge {
top: 0;
+ @include gl-py-0;
+ @include gl-px-2;
+}
+
+.gl-new-dropdown-contents .gl-badge,
+.gl-tab-nav-item .gl-badge {
+ @include gl-my-n1;
}
diff --git a/src/components/base/badge/badge.spec.js b/src/components/base/badge/badge.spec.js
index 1bc7f06c99c4313834cbc41040d05e233f259d78..670c0b5cbf48b9e6e9a88adf836be82f89bc65c3 100644
--- a/src/components/base/badge/badge.spec.js
+++ b/src/components/base/badge/badge.spec.js
@@ -40,12 +40,6 @@ describe('badge', () => {
expect(icon.props('name')).toBe(iconName);
});
- it('with correct class', () => {
- const icon = findIcon();
-
- expect(icon.classes('gl-mr-2')).toBe(hasSlot);
- });
-
it('with correct size', () => {
expect(findIcon().props('size')).toBe(expectedIconSize);
});
diff --git a/src/components/base/badge/badge.stories.js b/src/components/base/badge/badge.stories.js
index 4187954fbe6da49924f9c18620935bcbf218c362..bc80545a1c65032fda2eb284afd1ca56b12a035f 100644
--- a/src/components/base/badge/badge.stories.js
+++ b/src/components/base/badge/badge.stories.js
@@ -1,9 +1,5 @@
import iconSpriteInfo from '@gitlab/svgs/dist/icons.json';
-import {
- badgeSizeOptions,
- badgeVariantOptions,
- badgeIconSizeOptions,
-} from '../../../utils/constants';
+import { badgeVariantOptions, badgeIconSizeOptions } from '../../../utils/constants';
import { disableControls } from '../../../utils/stories_utils';
import GlBadge from './badge.vue';
import readme from './badge.md';
@@ -12,9 +8,8 @@ const template = `
{{ content }}
`;
@@ -22,14 +17,12 @@ const defaultValue = (prop) => GlBadge.props[prop].default;
const generateProps = ({
variant = defaultValue('variant'),
- size = defaultValue('size'),
href = '',
content = 'TestBadge',
icon = '',
iconSize = defaultValue('iconSize'),
} = {}) => ({
variant,
- size,
href,
content,
icon,
@@ -56,7 +49,6 @@ export const Variants = (args, { argTypes }) => ({
:key="variant"
:href="href"
:variant="variant"
- :size="size"
:icon="icon"
:iconSize="iconSize"
class="gl-mr-3"
@@ -80,7 +72,6 @@ export const Actionable = (args, { argTypes }) => ({
:key="variant"
:href="href"
:variant="variant"
- :size="size"
:icon="icon"
:iconSize="iconSize"
class="gl-mr-3"
@@ -96,37 +87,15 @@ Actionable.args = generateProps({
Actionable.tags = ['skip-visual-test'];
Actionable.argTypes = disableControls(['content', 'variant']);
-export const Sizes = (args, { argTypes }) => ({
- components: { GlBadge },
- props: Object.keys(argTypes),
- template: `
-
- {{ size }}
-
- `,
- badgeSizeOptions,
-});
-Sizes.args = generateProps({
- variant: badgeVariantOptions.danger,
-});
-Sizes.argTypes = disableControls(['content', 'size']);
-
export const BadgeIcon = (args, { argTypes }) => ({
components: { GlBadge },
props: Object.keys(argTypes),
template: `
- 16px icon
- 12px icon
+ With icon
+ With status open
+ With status closed
+ With sm icon
`,
});
@@ -140,7 +109,6 @@ export const IconOnly = (args, { argTypes }) => ({
@@ -168,10 +136,6 @@ export default {
options: Object.keys(badgeVariantOptions),
control: 'select',
},
- size: {
- options: Object.keys(badgeSizeOptions),
- control: 'select',
- },
icon: {
options: ['', ...iconSpriteInfo.icons],
control: 'select',
diff --git a/src/components/base/badge/badge.vue b/src/components/base/badge/badge.vue
index 2b886a6a892cb2318f8f76c44ad6d5999c1cb836..650e53eab86febdf71828944f941a41ec1b35b6b 100644
--- a/src/components/base/badge/badge.vue
+++ b/src/components/base/badge/badge.vue
@@ -1,11 +1,7 @@
-
+
{{ activeType.BADGE }}
{{ name }}
- Deprecated
+ Deprecated
{{ description }}
diff --git a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-avatar-labeled-with-badges-1-snap.png b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-avatar-labeled-with-badges-1-snap.png
index 2eb029b438714ead11cb8247019fe02fa44c8675..ebd7f36539c83297cd9620ac6a894ff9c45dd4c5 100644
Binary files a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-avatar-labeled-with-badges-1-snap.png and b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-avatar-labeled-with-badges-1-snap.png differ
diff --git a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-badge-badge-icon-1-snap.png b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-badge-badge-icon-1-snap.png
index 87ac288604c63e9d4939d317051115b948305c59..3c30eedc2180eae62d13540c2bb94adad4d87a5d 100644
Binary files a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-badge-badge-icon-1-snap.png and b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-badge-badge-icon-1-snap.png differ
diff --git a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-badge-icon-only-1-snap.png b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-badge-icon-only-1-snap.png
index b0dd6f88b52cd4e4de2c411e1fb2ffc2ad233f0c..9668050abb37bf9b22af6f5845c75e55e5569213 100644
Binary files a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-badge-icon-only-1-snap.png and b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-badge-icon-only-1-snap.png differ
diff --git a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-badge-sizes-1-snap.png b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-badge-sizes-1-snap.png
deleted file mode 100644
index 34b151fc008bf847abbfa3b5b240e33f1c32d745..0000000000000000000000000000000000000000
Binary files a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-badge-sizes-1-snap.png and /dev/null differ
diff --git a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-badge-variants-1-snap.png b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-badge-variants-1-snap.png
index 9408715a7b28796cb45616f4c6d696939389b567..0e55befc65d53d254cdcda6e1b840f52bd6dafa1 100644
Binary files a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-badge-variants-1-snap.png and b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-badge-variants-1-snap.png differ
diff --git a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-button-badge-with-sr-only-text-1-snap.png b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-button-badge-with-sr-only-text-1-snap.png
index 36ba9cfc0dad4ec38d5f49dc6b0b7171dff97b79..1d6caa96d2c4e97710242fc535e357d117d96c79 100644
Binary files a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-button-badge-with-sr-only-text-1-snap.png and b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-button-badge-with-sr-only-text-1-snap.png differ
diff --git a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-button-badges-1-snap.png b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-button-badges-1-snap.png
index 6d7da360aa8db0bbb359d64d72bb18c6400ab872..58d15d7b85be43a69e14ba58d2bf8c3862bf0cd3 100644
Binary files a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-button-badges-1-snap.png and b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-button-badges-1-snap.png differ
diff --git a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-dropdown-collapsible-listbox-custom-groups-and-items-1-snap.png b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-dropdown-collapsible-listbox-custom-groups-and-items-1-snap.png
index aad4e05d106cfd5324f0fba3433fdbd199055783..1f6523fd3568b99318f6b3f593633c39a035c056 100644
Binary files a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-dropdown-collapsible-listbox-custom-groups-and-items-1-snap.png and b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-dropdown-collapsible-listbox-custom-groups-and-items-1-snap.png differ
diff --git a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-dropdown-collapsible-listbox-group-without-label-1-snap.png b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-dropdown-collapsible-listbox-group-without-label-1-snap.png
index 5e67c455e4932aef306fec30f484126decaee958..96a8f2a1ad4e1a3f28114f9a3ad1ea223261cf5c 100644
Binary files a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-dropdown-collapsible-listbox-group-without-label-1-snap.png and b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-dropdown-collapsible-listbox-group-without-label-1-snap.png differ
diff --git a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-dropdown-disclosure-dropdown-custom-groups-and-items-1-snap.png b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-dropdown-disclosure-dropdown-custom-groups-and-items-1-snap.png
index af58f39bda4bef168bb99aead8016bbc0adada7a..283c7f712ec48b50721aa3185e85082ddc9b4a84 100644
Binary files a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-dropdown-disclosure-dropdown-custom-groups-and-items-1-snap.png and b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-dropdown-disclosure-dropdown-custom-groups-and-items-1-snap.png differ
diff --git a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-dropdown-disclosure-dropdown-custom-groups-items-and-toggle-1-snap.png b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-dropdown-disclosure-dropdown-custom-groups-items-and-toggle-1-snap.png
index e770490d2071832d6a631d5ebbc1361163462bc0..39ecdb4b90cdecceb558718da8a16863d0782c87 100644
Binary files a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-dropdown-disclosure-dropdown-custom-groups-items-and-toggle-1-snap.png and b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-dropdown-disclosure-dropdown-custom-groups-items-and-toggle-1-snap.png differ
diff --git a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-dropdown-disclosure-dropdown-custom-list-item-1-snap.png b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-dropdown-disclosure-dropdown-custom-list-item-1-snap.png
index 0f723c99520df589aabc151e53a8125aaea5898c..daa85706ac09c82f936509a006d9da743ca028c1 100644
Binary files a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-dropdown-disclosure-dropdown-custom-list-item-1-snap.png and b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-dropdown-disclosure-dropdown-custom-list-item-1-snap.png differ
diff --git a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-tabs-with-counter-badges-1-snap.png b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-tabs-with-counter-badges-1-snap.png
index 527871ecd8a8cc43273c61bd7f814e09076062c2..cfcfdb8e7426bf2254000b51fc4dd3ce2ddd24d4 100644
Binary files a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-tabs-with-counter-badges-1-snap.png and b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-base-tabs-with-counter-badges-1-snap.png differ
diff --git a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-experimental-duo-chat-duo-chat-default-1-snap.png b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-experimental-duo-chat-duo-chat-default-1-snap.png
index b68f64978cf8a3d1fdd430a35a9e9ca16802a239..5720e901bb5a5c5f7373d907fd37847aab29294c 100644
Binary files a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-experimental-duo-chat-duo-chat-default-1-snap.png and b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-experimental-duo-chat-duo-chat-default-1-snap.png differ
diff --git a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-experimental-duo-chat-duo-chat-interactive-1-snap.png b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-experimental-duo-chat-duo-chat-interactive-1-snap.png
index e9cbb3514ea77c1b63ab27723ac2934533594acd..c0c5d6fe8774257fd5a33eaa51568addd4189ba9 100644
Binary files a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-experimental-duo-chat-duo-chat-interactive-1-snap.png and b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-experimental-duo-chat-duo-chat-interactive-1-snap.png differ
diff --git a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-experimental-duo-chat-duo-chat-slots-1-snap.png b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-experimental-duo-chat-duo-chat-slots-1-snap.png
index 215e2d40f8fea700e7a9cdc972c080591f04bacb..0cfee74e01164bf7fede36dadecacb0390448959 100644
Binary files a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-experimental-duo-chat-duo-chat-slots-1-snap.png and b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-experimental-duo-chat-duo-chat-slots-1-snap.png differ
diff --git a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-tokens-color-transparency-gray-1-snap.png b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-tokens-color-transparency-gray-1-snap.png
index 387f61cf09f94747db7fc1cee129e1dbffee5d59..dd8f142afeb3d5bf106aaef29b15c87d2bf67bb6 100644
Binary files a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-tokens-color-transparency-gray-1-snap.png and b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-tokens-color-transparency-gray-1-snap.png differ
diff --git a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-tokens-color-transparency-white-1-snap.png b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-tokens-color-transparency-white-1-snap.png
index 78696b790cdb5e7788ae340085100218082fac23..db6ca206ee3c83eaed759374bd7cf186bca67a67 100644
Binary files a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-tokens-color-transparency-white-1-snap.png and b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-tokens-color-transparency-white-1-snap.png differ
diff --git a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-tokens-text-dark-1-snap.png b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-tokens-text-dark-1-snap.png
index 44bfda50d03f5c618e8ed80dbec2fbf631da1719..78f0d7747fa354ecac6c964cc1cd53c402579062 100644
Binary files a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-tokens-text-dark-1-snap.png and b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-tokens-text-dark-1-snap.png differ
diff --git a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-tokens-text-default-1-snap.png b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-tokens-text-default-1-snap.png
index f9bf7f27f55a25133e94cc3951bf845e277cde69..aeaf020f37e8f9390c1bc2794e69cbd557b14f9c 100644
Binary files a/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-tokens-text-default-1-snap.png and b/tests/__image_snapshots__/storyshots-spec-js-image-storyshots-tokens-text-default-1-snap.png differ