Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f77ca7f
add support for number and icons with vertical prop
BenOsodrac Mar 26, 2025
0aab47b
Merge branch 'next' into ROU-11750
BenOsodrac Mar 26, 2025
0e07a99
fix lint
BenOsodrac Mar 26, 2025
693e6d2
chore(): add updated snapshots
Ionitron Mar 26, 2025
03b223f
add best effort for ios/md styles
BenOsodrac Mar 26, 2025
ea78288
lint fix
BenOsodrac Mar 26, 2025
2cf9bd2
chore(): add updated snapshots
Ionitron Mar 26, 2025
3304502
fix native styles
BenOsodrac Mar 26, 2025
522b0fe
chore(): add updated snapshots
Ionitron Mar 26, 2025
efdd0fe
fix md style
BenOsodrac Mar 26, 2025
76f94fc
fix lint
BenOsodrac Mar 26, 2025
ba3cf9c
chore(): add updated snapshots
Ionitron Mar 26, 2025
a9e337d
fixed native var
BenOsodrac Mar 28, 2025
9eac519
added transform mixin usage
BenOsodrac Mar 28, 2025
290c9e4
add mixin to md file
BenOsodrac Mar 28, 2025
e764fa5
removed [vertical] selectors
BenOsodrac Mar 28, 2025
d12c8cb
fixed @use order
BenOsodrac Mar 28, 2025
2d4b488
fixed comments
BenOsodrac Mar 28, 2025
96bd044
fix lint
BenOsodrac Mar 28, 2025
760d71a
fixed size usage and css
BenOsodrac Mar 28, 2025
6369bca
Update core/src/components/avatar/avatar.md.scss
BenOsodrac Mar 28, 2025
76e90e0
chore(tokens): update design-tokens dependency to 1.2.2 (#30319)
BenOsodrac Mar 28, 2025
f13bd08
add badge native vars file
BenOsodrac Mar 28, 2025
1414ee7
remove vars from common
BenOsodrac Mar 28, 2025
68a42a8
Merge branch 'next' into ROU-11750
BenOsodrac Mar 28, 2025
3d93428
Apply suggestions from code review
BenOsodrac Mar 28, 2025
6be2877
Update core/src/components/badge/badge.native.vars.scss
BenOsodrac Mar 28, 2025
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
64 changes: 59 additions & 5 deletions core/src/components/avatar/avatar.ionic.scss
Original file line number Diff line number Diff line change
Expand Up @@ -153,23 +153,77 @@
height: globals.$ion-scale-1000;
}

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

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

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

:host ::slotted(ion-badge.badge-vertical-bottom:empty) {
transform: translate(0, globals.$ion-scale-100);
@include globals.transform(translate(0, globals.$ion-scale-100));
}

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

// Avatar Badge Bottom (hint)
// --------------------------------------------------

:host ::slotted(ion-badge.badge-vertical-bottom:not(:empty)) {
@include globals.transform(translate(50%, 50%));
}

:host(.avatar-xxsmall) ::slotted(ion-badge.badge-vertical-bottom:not(:empty)) {
@include globals.position(null, globals.$ion-scale-100, globals.$ion-scale-100, null);
@include globals.transform(translate(100%, 100%));
}

:host(.avatar-xsmall) ::slotted(ion-badge.badge-vertical-bottom:not(:empty)) {
@include globals.position(null, calc(globals.$ion-scale-050 * -1), calc(globals.$ion-scale-050 * -1), null);
}

:host(.avatar-small) ::slotted(ion-badge.badge-vertical-bottom:not(:empty)),
:host(.avatar-medium) ::slotted(ion-badge.badge-vertical-bottom:not(:empty)),
:host(.avatar-large) ::slotted(ion-badge.badge-vertical-bottom:not(:empty)) {
@include globals.position(null, globals.$ion-scale-050, globals.$ion-scale-050, null);
}

:host(.avatar-xlarge) ::slotted(ion-badge.badge-vertical-bottom:not(:empty)) {
@include globals.position(null, globals.$ion-scale-150, globals.$ion-scale-150, null);
}

// Avatar Badge Top (hint)
// --------------------------------------------------

:host ::slotted(ion-badge.badge-vertical-top:not(:empty)) {
@include globals.transform(translate(50%, -50%));
}

:host(.avatar-xxsmall) ::slotted(ion-badge.badge-vertical-top:not(:empty)) {
@include globals.position(globals.$ion-scale-050, 0, null, null);
}

:host(.avatar-xsmall) ::slotted(ion-badge.badge-vertical-top:not(:empty)) {
@include globals.position(globals.$ion-scale-100, calc(globals.$ion-scale-050 * -1), null, null);
}

:host(.avatar-small) ::slotted(ion-badge.badge-vertical-top:not(:empty)),
:host(.avatar-medium) ::slotted(ion-badge.badge-vertical-top:not(:empty)) {
@include globals.position(globals.$ion-scale-150, 0, null, null);
}

:host(.avatar-large) ::slotted(ion-badge.badge-vertical-top:not(:empty)) {
@include globals.position(globals.$ion-scale-150, globals.$ion-scale-050, null, null);
}

:host(.avatar-xlarge) ::slotted(ion-badge.badge-vertical-top:not(:empty)) {
@include globals.position(globals.$ion-scale-150, globals.$ion-scale-150, null, null);
}

// Avatar Disabled
Expand Down
11 changes: 10 additions & 1 deletion core/src/components/avatar/avatar.md.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@use "../../themes/native/native.globals.md" as globals;
@import "./avatar.common";
@import "./avatar.md.vars";

Expand All @@ -15,9 +16,17 @@
// --------------------------------------------------

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

::slotted(ion-badge.badge-vertical-bottom:empty) {
transform: translateX(-100%);
}

:host ::slotted(ion-badge.badge-vertical-top[vertical]:not(:empty)) {
@include globals.transform(translate(0, 100%));
}

:host ::slotted(ion-badge.badge-vertical-bottom[vertical]:not(:empty)) {
@include globals.transform(translate(0, -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 @@ -48,18 +48,18 @@
color: #{color.current-color(contrast)};
}

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

:host([vertical]:not(.in-tab-button)) {
@include position(null, 0, null, null);
position: absolute;
}

:host(:not(.in-tab-button):empty.badge-vertical-top) {
:host(:not(.in-tab-button)[vertical].badge-vertical-top) {
top: 0;
}

:host(:not(.in-tab-button):empty.badge-vertical-bottom) {
:host(:not(.in-tab-button)[vertical].badge-vertical-bottom) {
bottom: 0;
}
6 changes: 6 additions & 0 deletions core/src/components/badge/badge.common.vars.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ $badge-font-size: dynamic-font($badge-baseline-font-size);

/// @prop - Font weight of the badge
$badge-font-weight: bold;

/// @prop - Font size of the badge hint
$badge-hint-baseline-font-size: 8px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If $badge-hint-font-size is not needed as asked in my next question, then we can move this variable to the native variables since it's only being used there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


/// @prop - Font size of the badge hint
$badge-hint-font-size: dynamic-font($badge-hint-baseline-font-size);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this variable being used? I'm not seeing it in any file.

Suggested change
$badge-hint-font-size: dynamic-font($badge-hint-baseline-font-size);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be use don the badge.native.scss, but I wrongly used the $badge-hint-baseline-font-size there instead. Already fixed it.

I followed the same approach as the font-size vars arlready defined on that vars file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since these are for native usage only, create a badge.native.vars.scss file and move those tokens there. That way ionic isn't importing extra weight.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

16 changes: 12 additions & 4 deletions core/src/components/badge/badge.ionic.scss
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,22 @@
height: globals.$ion-scale-1000;
}

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

:host(:empty) {
--padding-start: 0;
--padding-end: 0;
}

// Badge Sizes Empty
:host([vertical]:not(:empty)) {
--padding-start: #{globals.$ion-scale-100};
--padding-end: #{globals.$ion-scale-100};
--padding-top: #{globals.$ion-scale-100};
--padding-bottom: #{globals.$ion-scale-100};
}

// Badge (hint) Sizes
// --------------------------------------------------

/* sm */
Expand Down Expand Up @@ -182,8 +189,9 @@
position: relative;
}

// Badge Icon when Inside Tab Button
:host([vertical].in-tab-button) ::slotted(ion-icon) {
// Icon Inside Badge Hint
// --------------------------------------------------
:host([vertical]) ::slotted(ion-icon) {
@include globals.position(50%, null, null, 50%);

position: absolute;
Expand Down
5 changes: 5 additions & 0 deletions core/src/components/badge/badge.native.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
}

// TODO(ROU-10747): Review size styles when sizes are defined for native themes.
:host([vertical]:not(.in-tab-button)),
:host(:empty) {
--padding-start: 0;
--padding-end: 0;
Expand All @@ -23,4 +24,8 @@

width: $badge-min-width;
height: $badge-min-width;

font-size: $badge-hint-font-size;

line-height: 10px;
}
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.
130 changes: 130 additions & 0 deletions core/src/components/badge/test/hint/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,136 @@
<ion-badge color="danger" size="large" vertical="bottom"></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="xxsmall" vertical="top">1</ion-badge>
</ion-avatar>
<ion-avatar size="xsmall">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="xxsmall" vertical="top">1</ion-badge>
</ion-avatar>
<ion-avatar size="small">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="xxsmall" vertical="top">1</ion-badge>
</ion-avatar>
<ion-avatar size="medium">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="xxsmall" vertical="top">1</ion-badge>
</ion-avatar>
<ion-avatar size="large">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="xxsmall" vertical="top">1</ion-badge>
</ion-avatar>
<ion-avatar size="xlarge">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="xxsmall" vertical="top">1</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="xxsmall" vertical="bottom">1</ion-badge>
</ion-avatar>
<ion-avatar size="xsmall">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="xxsmall" vertical="bottom">1</ion-badge>
</ion-avatar>
<ion-avatar size="small">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="xxsmall" vertical="bottom">1</ion-badge>
</ion-avatar>
<ion-avatar size="medium">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="xxsmall" vertical="bottom">1</ion-badge>
</ion-avatar>
<ion-avatar size="large">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="xxsmall" vertical="bottom">1</ion-badge>
</ion-avatar>
<ion-avatar size="xlarge">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="xxsmall" vertical="bottom">1</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="xxsmall" vertical="top">
<ion-icon icon="star"></ion-icon>
</ion-badge>
</ion-avatar>
<ion-avatar size="xsmall">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="xxsmall" vertical="top">
<ion-icon icon="star"></ion-icon>
</ion-badge>
</ion-avatar>
<ion-avatar size="small">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="xxsmall" vertical="top">
<ion-icon icon="star"></ion-icon>
</ion-badge>
</ion-avatar>
<ion-avatar size="medium">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="xxsmall" vertical="top">
<ion-icon icon="star"></ion-icon>
</ion-badge>
</ion-avatar>
<ion-avatar size="large">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="xxsmall" vertical="top">
<ion-icon icon="star"></ion-icon>
</ion-badge>
</ion-avatar>
<ion-avatar size="xlarge">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="xxsmall" vertical="top">
<ion-icon icon="star"></ion-icon>
</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="xxsmall" vertical="bottom">
<ion-icon icon="star"></ion-icon>
</ion-badge>
</ion-avatar>
<ion-avatar size="xsmall">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="xxsmall" vertical="bottom">
<ion-icon icon="star"></ion-icon>
</ion-badge>
</ion-avatar>
<ion-avatar size="small">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="xxsmall" vertical="bottom">
<ion-icon icon="star"></ion-icon>
</ion-badge>
</ion-avatar>
<ion-avatar size="medium">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="xxsmall" vertical="bottom">
<ion-icon icon="star"></ion-icon>
</ion-badge>
</ion-avatar>
<ion-avatar size="large">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="xxsmall" vertical="bottom">
<ion-icon icon="star"></ion-icon>
</ion-badge>
</ion-avatar>
<ion-avatar size="xlarge">
<img src="/src/components/avatar/test/avatar.svg" />
<ion-badge color="danger" size="xxsmall" vertical="bottom">
<ion-icon icon="star"></ion-icon>
</ion-badge>
</ion-avatar>
</div>
</ion-list>

<ion-list id="tab-button">
Expand Down
Loading