refactor(item): add slot styles (#29741)

Co-authored-by: ionitron <hi@ionicframework.com>
This commit is contained in:
Maria Hutt
2024-08-07 12:53:48 -07:00
committed by GitHub
parent 196a7bf1b9
commit 8fb813686f
17 changed files with 26 additions and 1 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -11,6 +11,9 @@
--border-color: #{globals.$ionic-color-neutral-300}; --border-color: #{globals.$ionic-color-neutral-300};
--border-style: #{globals.$ionic-border-style-solid}; --border-style: #{globals.$ionic-border-style-solid};
--border-width: #{0 0 globals.$ionic-border-size-025 0}; --border-width: #{0 0 globals.$ionic-border-size-025 0};
--detail-icon-color: #{globals.$ionic-color-neutral-800};
--detail-icon-font-size: #{globals.$ionic-scale-600};
--detail-icon-opacity: 1;
--min-height: #{globals.$ionic-scale-1800}; --min-height: #{globals.$ionic-scale-1800};
--padding-top: #{globals.$ionic-space-200}; --padding-top: #{globals.$ionic-space-200};
--padding-end: #{globals.$ionic-space-400}; --padding-end: #{globals.$ionic-space-400};
@ -29,6 +32,13 @@
min-height: initial; min-height: initial;
} }
// Item Detail Icon
// --------------------------------------------------
.item-detail-icon {
margin-inline-end: 0;
}
// Ionic Item Slots // Ionic Item Slots
// -------------------------------------------------- // --------------------------------------------------
@ -40,6 +50,12 @@ slot[name="end"]::slotted(*) {
@include globals.margin(null, null, null, #{globals.$ionic-space-400}); @include globals.margin(null, null, null, #{globals.$ionic-space-400});
} }
::slotted(ion-icon:not(.item-detail-icon)) {
color: globals.$ionic-color-neutral-1000;
font-size: globals.$ionic-scale-1000;
}
// Item: Disabled // Item: Disabled
// -------------------------------------------------- // --------------------------------------------------

View File

@ -264,6 +264,14 @@ export class Item implements ComponentInterface, AnchorInterface, ButtonInterfac
return config.get('itemDetailIcon', defaultIcon); return config.get('itemDetailIcon', defaultIcon);
} }
/**
* The icon should be flipped when the app is RTL and
* the icon is a variation of chevron.
*/
get shouldFlipIcon() {
return this.itemDetailIcon === chevronForward || this.itemDetailIcon === caretRightRegular;
}
render() { render() {
const { const {
detail, detail,
@ -273,6 +281,7 @@ export class Item implements ComponentInterface, AnchorInterface, ButtonInterfac
disabled, disabled,
href, href,
itemDetailIcon, itemDetailIcon,
shouldFlipIcon,
rel, rel,
target, target,
routerAnimation, routerAnimation,
@ -396,7 +405,7 @@ export class Item implements ComponentInterface, AnchorInterface, ButtonInterfac
class="item-detail-icon" class="item-detail-icon"
part="detail-icon" part="detail-icon"
aria-hidden="true" aria-hidden="true"
flip-rtl={itemDetailIcon === chevronForward} flip-rtl={shouldFlipIcon}
></ion-icon> ></ion-icon>
)} )}
</div> </div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 KiB

After

Width:  |  Height:  |  Size: 203 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

After

Width:  |  Height:  |  Size: 146 KiB