Skip to content

Commit

Permalink
Merge branch 'next' into ROU-10735
Browse files Browse the repository at this point in the history
  • Loading branch information
brandyscarney committed May 22, 2024
2 parents 451a56f + 258dabf commit 0cc0cdb
Show file tree
Hide file tree
Showing 12 changed files with 64 additions and 7 deletions.
2 changes: 1 addition & 1 deletion core/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ ion-backdrop,event,ionBackdropTap,void,true
ion-badge,shadow
ion-badge,prop,color,"danger" | "dark" | "light" | "medium" | "primary" | "secondary" | "success" | "tertiary" | "warning" | string & Record<never, never> | undefined,undefined,false,true
ion-badge,prop,mode,"ios" | "md",undefined,false,false
ion-badge,prop,size,"small" | undefined,undefined,false,false
ion-badge,prop,size,"large" | "medium" | "small" | undefined,undefined,false,false
ion-badge,prop,theme,"ios" | "md" | "ionic",undefined,false,false
ion-badge,css-prop,--background,ionic
ion-badge,css-prop,--background,ios
Expand Down
8 changes: 4 additions & 4 deletions core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,9 @@ export namespace Components {
*/
"mode"?: "ios" | "md";
/**
* Set to `"small"` for less height and width. Defaults to `"small"` for the `ionic` theme, undefined for all other themes.
* Set to `"small"` for less height and width. Set to "medium" for slightly larger dimensions. Set to "large" for even greater height and width. Defaults to `"small"` for the `ionic` theme, undefined for all other themes.
*/
"size"?: 'small';
"size"?: 'small' | 'medium' | 'large';
/**
* The theme determines the visual appearance of the component.
*/
Expand Down Expand Up @@ -5650,9 +5650,9 @@ declare namespace LocalJSX {
*/
"mode"?: "ios" | "md";
/**
* Set to `"small"` for less height and width. Defaults to `"small"` for the `ionic` theme, undefined for all other themes.
* Set to `"small"` for less height and width. Set to "medium" for slightly larger dimensions. Set to "large" for even greater height and width. Defaults to `"small"` for the `ionic` theme, undefined for all other themes.
*/
"size"?: 'small';
"size"?: 'small' | 'medium' | 'large';
/**
* The theme determines the visual appearance of the component.
*/
Expand Down
23 changes: 23 additions & 0 deletions core/src/components/badge/badge.ionic.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,26 @@

line-height: globals.$ionic-line-height-600;
}

/* Medium Badge */
:host(.badge-medium) {
min-width: globals.$ionic-scale-1000;
height: globals.$ionic-scale-1000;

font-size: globals.$ionic-font-size-450;

line-height: globals.$ionic-line-height-700;
}

/* Large Badge */
:host(.badge-large) {
--padding-start: #{globals.$ionic-space-200};
--padding-end: #{globals.$ionic-space-200};

min-width: globals.$ionic-scale-1200;
height: globals.$ionic-scale-1200;

font-size: globals.$ionic-font-size-500;

line-height: globals.$ionic-line-height-700;
}
4 changes: 2 additions & 2 deletions core/src/components/badge/badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ export class Badge implements ComponentInterface {
@Prop({ reflect: true }) color?: Color;

/**
* Set to `"small"` for less height and width.
* Set to `"small"` for less height and width. Set to "medium" for slightly larger dimensions. Set to "large" for even greater height and width.
* Defaults to `"small"` for the `ionic` theme, undefined for all other themes.
*/
@Prop() size?: 'small';
@Prop() size?: 'small' | 'medium' | 'large';

private getSize(): string | undefined {
const theme = getIonTheme(this);
Expand Down
26 changes: 26 additions & 0 deletions core/src/components/badge/test/size/badge.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,31 @@ configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ config, screens

await expect(badge).toHaveScreenshot(screenshot(`badge-size-small`));
});

test('should render medium badges', async ({ page }) => {
await page.setContent(
`
<ion-badge size="medium">00</ion-badge>
`,
config
);

const badge = page.locator('ion-badge');

await expect(badge).toHaveScreenshot(screenshot(`badge-size-medium`));
});

test('should render large badges', async ({ page }) => {
await page.setContent(
`
<ion-badge size="large">00</ion-badge>
`,
config
);

const badge = page.locator('ion-badge');

await expect(badge).toHaveScreenshot(screenshot(`badge-size-large`));
});
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions core/src/components/badge/test/size/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@
<ion-label>Small Badge</ion-label>
<ion-badge slot="end" size="small">00</ion-badge>
</ion-item>
<ion-item>
<ion-label>Medium Badge</ion-label>
<ion-badge slot="end" size="medium">00</ion-badge>
</ion-item>
<ion-item>
<ion-label>Large Badge</ion-label>
<ion-badge slot="end" size="large">00</ion-badge>
</ion-item>
</ion-list>
</ion-content>
</ion-app>
Expand Down

0 comments on commit 0cc0cdb

Please sign in to comment.