Skip to content

Commit 53e64e6

Browse files
committed
feat(tab-button): Adding styling to the badge.
1 parent 2ea2c3a commit 53e64e6

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
@use "../../themes/ionic/ionic.globals.scss" as globals;
2+
@import "../../themes/mixins";
3+
14
:host {
25
/**
36
* @prop --background: Background of the tab button
@@ -152,6 +155,41 @@
152155
z-index: 1;
153156
}
154157

158+
:host ::slotted(ion-badge[vertical]:empty) {
159+
@include padding(0, 0);
160+
161+
height: globals.$ion-scale-200;
162+
width: globals.$ion-scale-200;
163+
}
164+
165+
:host ::slotted(ion-badge[vertical]) {
166+
left: 50%;
167+
transform: translateX(globals.$ion-scale-300);
168+
}
169+
170+
:host ::slotted(ion-badge[vertical="top"]) {
171+
top: globals.$ion-scale-0;
172+
}
173+
174+
:host ::slotted(ion-badge[vertical="bottom"]) {
175+
top: 50%;
176+
transform: translate(globals.$ion-scale-300, calc(globals.$ion-scale-200 * -1));
177+
}
178+
179+
:host ::slotted(ion-badge[vertical="bottom"]:empty) {
180+
transform: translate(globals.$ion-scale-300, calc(globals.$ion-scale-100 * -1));
181+
}
182+
183+
:host ::slotted(ion-badge[vertical]:not(:empty)) {
184+
@include padding(2px, 4px, 4px, 4px);
185+
186+
font-size: globals.$ion-font-size-300;
187+
line-height: 1;
188+
189+
height: globals.$ion-scale-400;
190+
min-width: globals.$ion-scale-400;
191+
}
192+
155193
// Tab Button: Layout
156194
// --------------------------------------------------
157195

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

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

45
// Ionic Tab Button
56
// --------------------------------------------------------------
@@ -27,6 +28,8 @@
2728
@include globals.margin(0);
2829
@include globals.padding(var(--padding-top), var(--padding-end), var(--padding-bottom), var(--padding-start));
2930
@include globals.text-inherit();
31+
32+
overflow: visible;
3033
}
3134

3235
.button-native::after {
@@ -86,3 +89,14 @@
8689
:host(.tab-button-shape-rectangular) {
8790
@include globals.border-radius(globals.$ion-border-radius-0);
8891
}
92+
93+
// Tab Button: Badge
94+
// --------------------------------------------------
95+
96+
:host ::slotted(ion-badge[vertical="top"]) {
97+
top: calc(globals.$ion-scale-200 * -1);
98+
}
99+
100+
:host ::slotted(ion-badge[vertical]:not(:empty)) {
101+
@include padding(3px, 4px, 4px, 4px);
102+
}

0 commit comments

Comments
 (0)