Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions core/src/components/avatar/avatar.common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
@include border-radius(var(--border-radius));

display: block;

position: relative;
}

::slotted(ion-img),
Expand Down
19 changes: 19 additions & 0 deletions core/src/components/avatar/avatar.ionic.scss
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,22 @@
width: globals.$ion-scale-1000;
height: globals.$ion-scale-1000;
}

// Avatar Empty Badge (hint)
// --------------------------------------------------

:host(.avatar-xxsmall) ::slotted(ion-badge.badge-vertical-top:empty) {
transform: translate(globals.$ion-scale-100, calc(globals.$ion-scale-100 * -1));
}

:host(:not(.avatar-xxsmall)) ::slotted(ion-badge.badge-vertical-top:empty) {
transform: translate(globals.$ion-scale-050, calc(globals.$ion-scale-050 * -1));
}

:host(.avatar-xxsmall) ::slotted(ion-badge.badge-vertical-bottom:empty) {
transform: translate(globals.$ion-scale-100, calc(globals.$ion-scale-100));
}

:host(:not(.avatar-xxsmall)) ::slotted(ion-badge.badge-vertical-bottom:empty) {
transform: translate(0, globals.$ion-scale-100);
}
11 changes: 11 additions & 0 deletions core/src/components/avatar/avatar.md.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,14 @@
width: $avatar-md-width;
height: $avatar-md-height;
}

// Avatar Empty Badge (hint)
// --------------------------------------------------

::slotted(ion-badge.badge-vertical-top:empty) {
transform: translate(-50%, 50%);
}

::slotted(ion-badge.badge-vertical-bottom:empty) {
transform: translateX(-100%);
}
6 changes: 3 additions & 3 deletions core/src/components/badge/badge.common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@
// Badge Empty (hint)
// --------------------------------------------------

:host(:empty[position]) {
:host(:empty[vertical]) {
@include position(null, 0, null, null);
position: absolute;
}

:host(:empty.badge-top) {
:host(:empty.badge-vertical-top) {
top: 0;
}

:host(:empty.badge-bottom) {
:host(:empty.badge-vertical-bottom) {
bottom: 0;
}
2 changes: 1 addition & 1 deletion core/src/components/badge/badge.ionic.scss
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
--padding-end: 0;
}

:host(:empty[position]) {
:host(:empty[vertical]) {
border: globals.$ion-border-size-025 globals.$ion-border-style-solid globals.$ion-bg-surface-inverse;
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/components/badge/badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class Badge implements ComponentInterface {
[theme]: true,
[`badge-${shape}`]: shape !== undefined,
[`badge-${size}`]: size !== undefined,
[`badge-${this.vertical}`]: this.vertical !== undefined,
[`badge-vertical-${this.vertical}`]: this.vertical !== undefined,
})}
>
<slot></slot>
Expand Down
16 changes: 13 additions & 3 deletions core/src/components/badge/test/hint/badge.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@ import { expect } from '@playwright/test';
import { configs, test } from '@utils/test/playwright';

configs({ directions: ['ltr'], modes: ['md', 'ios', 'ionic-md'] }).forEach(({ config, screenshot, title }) => {
test.describe(title('badge: hint'), () => {
test.describe(title('badge: hint empty'), () => {
test('should not have visual regressions', async ({ page }) => {
await page.goto('/src/components/badge/test/hint', config);

const container = page.locator('ion-list');
const container = page.locator('#empty');

await expect(container).toHaveScreenshot(screenshot(`badge-hint`));
await expect(container).toHaveScreenshot(screenshot(`badge-hint-empty`));
});
});

test.describe(title('badge: hint inside avatar'), () => {
test('should not have visual regressions', async ({ page }) => {
await page.goto('/src/components/badge/test/hint', config);

const container = page.locator('#avatar');

await expect(container).toHaveScreenshot(screenshot(`badge-hint-avatar`));
});
});
});
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.
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.
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.
60 changes: 59 additions & 1 deletion core/src/components/badge/test/hint/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</ion-header>

<ion-content id="content">
<ion-list>
<ion-list id="empty">
<ion-list-header>
<ion-label> Badge Empty </ion-label>
</ion-list-header>
Expand All @@ -40,6 +40,64 @@
<ion-badge color="warning" size="large"></ion-badge>
</ion-item>
</ion-list>

<ion-list id="avatar">
<ion-list-header>
<ion-label> Inside Avatar </ion-label>
</ion-list-header>
<div class="ion-display-flex ion-align-items-center ion-justify-content-around ion-margin">
<ion-avatar size="xxsmall">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="small" vertical="top"></ion-badge>
</ion-avatar>
<ion-avatar size="xsmall">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="small" vertical="top"></ion-badge>
</ion-avatar>
<ion-avatar size="small">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="medium" vertical="top"></ion-badge>
</ion-avatar>
<ion-avatar size="medium">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="medium" vertical="top"></ion-badge>
</ion-avatar>
<ion-avatar size="large">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="medium" vertical="top"></ion-badge>
</ion-avatar>
<ion-avatar size="xlarge">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="large" vertical="top"></ion-badge>
</ion-avatar>
</div>
<div class="ion-display-flex ion-align-items-center ion-justify-content-around ion-margin">
<ion-avatar size="xxsmall">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="small" vertical="bottom"></ion-badge>
</ion-avatar>
<ion-avatar size="xsmall">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="small" vertical="bottom"></ion-badge>
</ion-avatar>
<ion-avatar size="small">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="medium" vertical="bottom"></ion-badge>
</ion-avatar>
<ion-avatar size="medium">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="medium" vertical="bottom"></ion-badge>
</ion-avatar>
<ion-avatar size="large">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="medium" vertical="bottom"></ion-badge>
</ion-avatar>
<ion-avatar size="xlarge">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="large" vertical="bottom"></ion-badge>
</ion-avatar>
</div>
</ion-list>
</ion-content>
</ion-app>
</body>
Expand Down
Loading