Skip to content

Commit ae4187c

Browse files
CR
1 parent ab9acac commit ae4187c

File tree

7 files changed

+56
-35
lines changed

7 files changed

+56
-35
lines changed

core/src/components/badge/badge.common.scss

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
@use "../../themes/ionic/ionic.globals.scss" as globals;
21
@use "../../themes/functions.color" as color;
32
@import "../../themes/mixins";
43
@import "./badge.common.vars";
@@ -68,21 +67,16 @@
6867
// Badge in Button
6968
// --------------------------------------------------
7069

71-
:host([vertical]:not(.in-tab-button).in-button) {
72-
// stylelint-disable-next-line property-disallowed-list
73-
right: globals.$ion-space-050;
74-
}
75-
7670
:host(:not(:empty).in-button) {
77-
min-width: globals.$ion-scale-400;
78-
height: globals.$ion-scale-400;
71+
min-width: $badge-size-in-button;
72+
height: $badge-size-in-button;
7973

80-
font-size: globals.$ion-font-size-300;
74+
font-size: $badge-font-size-in-button;
8175

82-
line-height: globals.$ion-font-line-height-500;
76+
line-height: $badge-line-height-in-button;
8377

8478
::slotted(ion-icon) {
85-
width: globals.$ion-scale-300;
86-
height: globals.$ion-scale-300;
79+
width: $badge-icon-size-in-button;
80+
height: $badge-icon-size-in-button;
8781
}
8882
}

core/src/components/badge/badge.common.vars.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@import "../../themes/functions.font";
2+
@import "../../themes/functions.sizes";
23

34
// Badge
45
// --------------------------------------------------
@@ -26,3 +27,15 @@ $badge-font-size: dynamic-font($badge-baseline-font-size);
2627

2728
/// @prop - Font weight of the badge
2829
$badge-font-weight: bold;
30+
31+
/// @prop - Size of the badge when inside button
32+
$badge-size-in-button: 16px;
33+
34+
/// @prop - Font size of the badge when inside button
35+
$badge-font-size-in-button: px-to-rem(12);
36+
37+
/// @prop - Line height of the badge when inside button
38+
$badge-line-height-in-button: 20px;
39+
40+
/// @prop - Size of of the badge icon when inside button
41+
$badge-icon-size-in-button: 12px;

core/src/components/badge/badge.ionic.scss

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@use "../../themes/ionic/ionic.globals.scss" as globals;
22
@use "./badge.common";
3+
@import "../../themes/mixins";
34

45
// Ionic Badge
56
// --------------------------------------------------
@@ -194,7 +195,14 @@
194195
// Badge in Button
195196
// --------------------------------------------------
196197

198+
:host([vertical]:not(.in-tab-button).in-button.badge-xxsmall),
199+
:host([vertical]:not(.in-tab-button).in-button.badge-xsmall),
197200
:host([vertical]:not(.in-tab-button).in-button.badge-small) {
198-
// stylelint-disable-next-line property-disallowed-list
199-
right: calc(-1 * globals.$ion-space-050);
201+
@include position(null, calc(-1 * var(globals.$ion-space-050)), null, null);
202+
}
203+
204+
:host([vertical]:not(.in-tab-button).in-button.badge-medium),
205+
:host([vertical]:not(.in-tab-button).in-button.badge-large),
206+
:host([vertical]:not(.in-tab-button).in-button.badge-xlarge) {
207+
@include position(null, globals.$ion-space-050, null, null);
200208
}

core/src/components/button/button.common.scss

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@use "../../themes/ionic/ionic.globals.scss" as globals;
1+
@import "../../themes/mixins";
22
@import "./button.vars";
33

44
// Button
@@ -314,15 +314,35 @@ ion-ripple-effect {
314314
// This rule only works in Chrome
315315
:has(ion-badge) .button-native {
316316
overflow: visible;
317+
318+
ion-ripple-effect {
319+
// stylelint-disable-next-line property-disallowed-list
320+
border-radius: inherit;
321+
}
322+
323+
&::after {
324+
// stylelint-disable-next-line property-disallowed-list
325+
border-radius: inherit;
326+
}
317327
}
318328

319329
// This rule only works in Safari
320330
:host(:has(ion-badge)) .button-native {
321331
overflow: visible;
332+
333+
ion-ripple-effect {
334+
// stylelint-disable-next-line property-disallowed-list
335+
border-radius: inherit;
336+
}
337+
338+
&::after {
339+
// stylelint-disable-next-line property-disallowed-list
340+
border-radius: inherit;
341+
}
322342
}
323343

324344
:host ::slotted(ion-badge[vertical]:not(:empty)) {
325-
@include globals.padding(globals.$ion-scale-050);
345+
@include padding($button-badge-padding);
326346

327347
display: flex;
328348

core/src/components/button/button.ionic.scss

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -290,18 +290,3 @@
290290
:host(.button-xlarge) ::slotted(ion-spinner[slot="end"]) {
291291
@include globals.margin-horizontal(globals.$ion-space-300, null);
292292
}
293-
294-
// Button Badge
295-
// --------------------------------------------------
296-
297-
:has(ion-badge) .button-native {
298-
ion-ripple-effect {
299-
// stylelint-disable-next-line property-disallowed-list
300-
border-radius: inherit;
301-
}
302-
303-
&::after {
304-
// stylelint-disable-next-line property-disallowed-list
305-
border-radius: inherit;
306-
}
307-
}

core/src/components/button/button.native.scss

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
// Button Badge
2727
// --------------------------------------------------
2828

29-
:has(ion-badge) .button-native {
30-
::slotted(ion-badge) {
31-
position: fixed;
32-
}
29+
.button-native ::slotted(ion-badge) {
30+
position: fixed;
3331
}

core/src/components/button/button.vars.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22

33
// Button
44
// --------------------------------------------------
5+
6+
/// @prop - Badge padding inside button
7+
$button-badge-padding: 2px;

0 commit comments

Comments
 (0)