Skip to content

Commit 8fb8136

Browse files
thetaPCIonitron
andauthored
refactor(item): add slot styles (#29741)
Co-authored-by: ionitron <[email protected]>
1 parent 196a7bf commit 8fb8136

17 files changed

+26
-1
lines changed
Loading
Loading
Loading
Loading
Loading
Loading

core/src/components/item/item.ionic.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
--border-color: #{globals.$ionic-color-neutral-300};
1212
--border-style: #{globals.$ionic-border-style-solid};
1313
--border-width: #{0 0 globals.$ionic-border-size-025 0};
14+
--detail-icon-color: #{globals.$ionic-color-neutral-800};
15+
--detail-icon-font-size: #{globals.$ionic-scale-600};
16+
--detail-icon-opacity: 1;
1417
--min-height: #{globals.$ionic-scale-1800};
1518
--padding-top: #{globals.$ionic-space-200};
1619
--padding-end: #{globals.$ionic-space-400};
@@ -29,6 +32,13 @@
2932
min-height: initial;
3033
}
3134

35+
// Item Detail Icon
36+
// --------------------------------------------------
37+
38+
.item-detail-icon {
39+
margin-inline-end: 0;
40+
}
41+
3242
// Ionic Item Slots
3343
// --------------------------------------------------
3444

@@ -40,6 +50,12 @@ slot[name="end"]::slotted(*) {
4050
@include globals.margin(null, null, null, #{globals.$ionic-space-400});
4151
}
4252

53+
::slotted(ion-icon:not(.item-detail-icon)) {
54+
color: globals.$ionic-color-neutral-1000;
55+
56+
font-size: globals.$ionic-scale-1000;
57+
}
58+
4359
// Item: Disabled
4460
// --------------------------------------------------
4561

core/src/components/item/item.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,14 @@ export class Item implements ComponentInterface, AnchorInterface, ButtonInterfac
264264
return config.get('itemDetailIcon', defaultIcon);
265265
}
266266

267+
/**
268+
* The icon should be flipped when the app is RTL and
269+
* the icon is a variation of chevron.
270+
*/
271+
get shouldFlipIcon() {
272+
return this.itemDetailIcon === chevronForward || this.itemDetailIcon === caretRightRegular;
273+
}
274+
267275
render() {
268276
const {
269277
detail,
@@ -273,6 +281,7 @@ export class Item implements ComponentInterface, AnchorInterface, ButtonInterfac
273281
disabled,
274282
href,
275283
itemDetailIcon,
284+
shouldFlipIcon,
276285
rel,
277286
target,
278287
routerAnimation,
@@ -396,7 +405,7 @@ export class Item implements ComponentInterface, AnchorInterface, ButtonInterfac
396405
class="item-detail-icon"
397406
part="detail-icon"
398407
aria-hidden="true"
399-
flip-rtl={itemDetailIcon === chevronForward}
408+
flip-rtl={shouldFlipIcon}
400409
></ion-icon>
401410
)}
402411
</div>
61.7 KB
Loading
76.8 KB
Loading

0 commit comments

Comments
 (0)