diff --git a/core/src/components.d.ts b/core/src/components.d.ts index 7e8a82744a..8b44d6d181 100644 --- a/core/src/components.d.ts +++ b/core/src/components.d.ts @@ -418,7 +418,7 @@ export namespace Components { */ "mode"?: "ios" | "md"; /** - * Set to `"soft"` for slightly rounded corners. Set to `"round"` for fully rounded corners. Defaults to `"round"` for the `ionic` theme, undefined for all other themes. + * Set to `"rectangular"` for non-rounded corners. Set to `"soft"` for slightly rounded corners. Set to `"round"` for fully rounded corners. Defaults to `"round"` for the `ionic` theme, undefined for all other themes. */ "shape"?: 'soft' | 'round'; /** @@ -5666,7 +5666,7 @@ declare namespace LocalJSX { */ "mode"?: "ios" | "md"; /** - * Set to `"soft"` for slightly rounded corners. Set to `"round"` for fully rounded corners. Defaults to `"round"` for the `ionic` theme, undefined for all other themes. + * Set to `"rectangular"` for non-rounded corners. Set to `"soft"` for slightly rounded corners. Set to `"round"` for fully rounded corners. Defaults to `"round"` for the `ionic` theme, undefined for all other themes. */ "shape"?: 'soft' | 'round'; /** diff --git a/core/src/components/badge/badge.ionic.scss b/core/src/components/badge/badge.ionic.scss index cfa443f2d9..0ec10a3496 100644 --- a/core/src/components/badge/badge.ionic.scss +++ b/core/src/components/badge/badge.ionic.scss @@ -32,10 +32,16 @@ @include border-radius(globals.$ionic-border-radius-100); } +/* Round Badge */ :host(.badge-round) { @include border-radius(globals.$ionic-border-radius-full); } +/* Rectangular Badge */ +:host(.badge-rectangular) { + @include border-radius(globals.$ionic-border-radius-0); +} + // Badge Sizes // -------------------------------------------------- diff --git a/core/src/components/badge/badge.tsx b/core/src/components/badge/badge.tsx index 99cbb8ae5d..43c4c9846f 100644 --- a/core/src/components/badge/badge.tsx +++ b/core/src/components/badge/badge.tsx @@ -27,6 +27,7 @@ export class Badge implements ComponentInterface { @Prop({ reflect: true }) color?: Color; /** + * Set to `"rectangular"` for non-rounded corners. * Set to `"soft"` for slightly rounded corners. * Set to `"round"` for fully rounded corners. * diff --git a/core/src/components/badge/test/shape/badge.e2e.ts b/core/src/components/badge/test/shape/badge.e2e.ts index 982cc38d9b..5721737781 100644 --- a/core/src/components/badge/test/shape/badge.e2e.ts +++ b/core/src/components/badge/test/shape/badge.e2e.ts @@ -99,5 +99,31 @@ configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ config, screens await expect(badge).toHaveScreenshot(screenshot(`badge-shape-round-long-text`)); }); + + test('should render rectangular badges', async ({ page }) => { + await page.setContent( + ` + 1 + `, + config + ); + + const badge = page.locator('ion-badge'); + + await expect(badge).toHaveScreenshot(screenshot(`badge-shape-rectangular`)); + }); + + test('should render rectangular badges with long text', async ({ page }) => { + await page.setContent( + ` + 99+ + `, + config + ); + + const badge = page.locator('ion-badge'); + + await expect(badge).toHaveScreenshot(screenshot(`badge-shape-rectangular-long-text`)); + }); }); }); diff --git a/core/src/components/badge/test/shape/badge.e2e.ts-snapshots/badge-shape-rectangular-ionic-md-ltr-light-Mobile-Chrome-linux.png b/core/src/components/badge/test/shape/badge.e2e.ts-snapshots/badge-shape-rectangular-ionic-md-ltr-light-Mobile-Chrome-linux.png new file mode 100644 index 0000000000..4ea3ecb6f1 Binary files /dev/null and b/core/src/components/badge/test/shape/badge.e2e.ts-snapshots/badge-shape-rectangular-ionic-md-ltr-light-Mobile-Chrome-linux.png differ diff --git a/core/src/components/badge/test/shape/badge.e2e.ts-snapshots/badge-shape-rectangular-ionic-md-ltr-light-Mobile-Firefox-linux.png b/core/src/components/badge/test/shape/badge.e2e.ts-snapshots/badge-shape-rectangular-ionic-md-ltr-light-Mobile-Firefox-linux.png new file mode 100644 index 0000000000..1e67e0a412 Binary files /dev/null and b/core/src/components/badge/test/shape/badge.e2e.ts-snapshots/badge-shape-rectangular-ionic-md-ltr-light-Mobile-Firefox-linux.png differ diff --git a/core/src/components/badge/test/shape/badge.e2e.ts-snapshots/badge-shape-rectangular-ionic-md-ltr-light-Mobile-Safari-linux.png b/core/src/components/badge/test/shape/badge.e2e.ts-snapshots/badge-shape-rectangular-ionic-md-ltr-light-Mobile-Safari-linux.png new file mode 100644 index 0000000000..43abbcfa3a Binary files /dev/null and b/core/src/components/badge/test/shape/badge.e2e.ts-snapshots/badge-shape-rectangular-ionic-md-ltr-light-Mobile-Safari-linux.png differ diff --git a/core/src/components/badge/test/shape/badge.e2e.ts-snapshots/badge-shape-rectangular-long-text-ionic-md-ltr-light-Mobile-Chrome-linux.png b/core/src/components/badge/test/shape/badge.e2e.ts-snapshots/badge-shape-rectangular-long-text-ionic-md-ltr-light-Mobile-Chrome-linux.png new file mode 100644 index 0000000000..a20bbce159 Binary files /dev/null and b/core/src/components/badge/test/shape/badge.e2e.ts-snapshots/badge-shape-rectangular-long-text-ionic-md-ltr-light-Mobile-Chrome-linux.png differ diff --git a/core/src/components/badge/test/shape/badge.e2e.ts-snapshots/badge-shape-rectangular-long-text-ionic-md-ltr-light-Mobile-Firefox-linux.png b/core/src/components/badge/test/shape/badge.e2e.ts-snapshots/badge-shape-rectangular-long-text-ionic-md-ltr-light-Mobile-Firefox-linux.png new file mode 100644 index 0000000000..408e455f67 Binary files /dev/null and b/core/src/components/badge/test/shape/badge.e2e.ts-snapshots/badge-shape-rectangular-long-text-ionic-md-ltr-light-Mobile-Firefox-linux.png differ diff --git a/core/src/components/badge/test/shape/badge.e2e.ts-snapshots/badge-shape-rectangular-long-text-ionic-md-ltr-light-Mobile-Safari-linux.png b/core/src/components/badge/test/shape/badge.e2e.ts-snapshots/badge-shape-rectangular-long-text-ionic-md-ltr-light-Mobile-Safari-linux.png new file mode 100644 index 0000000000..a6ddc23b6e Binary files /dev/null and b/core/src/components/badge/test/shape/badge.e2e.ts-snapshots/badge-shape-rectangular-long-text-ionic-md-ltr-light-Mobile-Safari-linux.png differ diff --git a/core/src/components/badge/test/shape/index.html b/core/src/components/badge/test/shape/index.html index cd06154b50..014299c097 100644 --- a/core/src/components/badge/test/shape/index.html +++ b/core/src/components/badge/test/shape/index.html @@ -18,7 +18,7 @@ - Button - Shape + Badge - Shape @@ -26,7 +26,7 @@ Default - 00 + 1 99+ @@ -39,6 +39,11 @@ 1 99+ + + Rectangular + 1 + 99+ +