fix(item): use thumbnail's size when present (#27014)

resolves #22935

---------

Co-authored-by: ionitron <hi@ionicframework.com>
Co-authored-by: liamdebeasi <liamdebeasi@users.noreply.github.com>
This commit is contained in:
Maria Hutt
2023-03-24 11:32:14 -07:00
committed by GitHub
parent 3b99c31bab
commit 6cecdf4145
12 changed files with 34 additions and 21 deletions

View File

@ -96,13 +96,11 @@
height: $item-md-avatar-height; height: $item-md-avatar-height;
} }
// Material Design Item Divider Thumbnail // Material Design Item Divider Thumbnail
// -------------------------------------------------- // --------------------------------------------------
::slotted(ion-thumbnail) { ::slotted(ion-thumbnail) {
width: $item-md-thumbnail-width; --size: #{$item-md-thumbnail-size};
height: $item-md-thumbnail-height;
} }
// Material Design Item Divider Avatar/Thumbnail // Material Design Item Divider Avatar/Thumbnail

View File

@ -154,8 +154,7 @@
font-size: 13px; font-size: 13px;
} }
// iOS Item Avatar
// iOS Item Avatar & Thumbnail
// -------------------------------------------------- // --------------------------------------------------
::slotted(ion-avatar) { ::slotted(ion-avatar) {
@ -163,11 +162,16 @@
height: $item-ios-avatar-height; height: $item-ios-avatar-height;
} }
// iOS Item Thumbnail
// --------------------------------------------------
::slotted(ion-thumbnail) { ::slotted(ion-thumbnail) {
width: $item-ios-thumbnail-width; --size: #{$item-ios-thumbnail-size};
height: $item-ios-thumbnail-height;
} }
// iOS Item Avatar/Thumbnail
// --------------------------------------------------
::slotted(ion-avatar[slot="end"]), ::slotted(ion-avatar[slot="end"]),
::slotted(ion-thumbnail[slot="end"]) { ::slotted(ion-thumbnail[slot="end"]) {
@include margin(($item-ios-padding-end * 0.5)); @include margin(($item-ios-padding-end * 0.5));

View File

@ -33,11 +33,8 @@ $item-ios-avatar-width: 36px !default;
/// @prop - Height of the avatar in the item /// @prop - Height of the avatar in the item
$item-ios-avatar-height: $item-ios-avatar-width !default; $item-ios-avatar-height: $item-ios-avatar-width !default;
/// @prop - Width of the thumbnail in the item /// @prop - Size of the thumbnail in the item
$item-ios-thumbnail-width: 56px !default; $item-ios-thumbnail-size: 56px !default;
/// @prop - Height of the thumbnail in the item
$item-ios-thumbnail-height: $item-ios-thumbnail-width !default;
/// @prop - Color of the detail arrow icon /// @prop - Color of the detail arrow icon
$item-ios-detail-icon-color: $item-ios-border-color !default; $item-ios-detail-icon-color: $item-ios-border-color !default;

View File

@ -258,7 +258,6 @@
@include padding-horizontal($item-md-note-end-slot-padding-start, $item-md-note-end-slot-padding-end); @include padding-horizontal($item-md-note-end-slot-padding-start, $item-md-note-end-slot-padding-end);
} }
// Material Design Item Avatar // Material Design Item Avatar
// -------------------------------------------------- // --------------------------------------------------
@ -267,13 +266,11 @@
height: $item-md-avatar-height; height: $item-md-avatar-height;
} }
// Material Design Item Thumbnail // Material Design Item Thumbnail
// -------------------------------------------------- // --------------------------------------------------
::slotted(ion-thumbnail) { ::slotted(ion-thumbnail) {
width: $item-md-thumbnail-width; --size: #{$item-md-thumbnail-size};
height: $item-md-thumbnail-height;
} }
// Material Design Item Avatar/Thumbnail // Material Design Item Avatar/Thumbnail

View File

@ -18,11 +18,8 @@ $item-md-avatar-width: 40px !default;
/// @prop - Height of the avatar in the item /// @prop - Height of the avatar in the item
$item-md-avatar-height: $item-md-avatar-width !default; $item-md-avatar-height: $item-md-avatar-width !default;
/// @prop - Width of the thumbnail in the item /// @prop - Size of the thumbnail in the item
$item-md-thumbnail-width: 56px !default; $item-md-thumbnail-size: 56px !default;
/// @prop - Height of the thumbnail in the item
$item-md-thumbnail-height: $item-md-thumbnail-width !default;
/// @prop - Color of the detail arrow icon /// @prop - Color of the detail arrow icon
$item-md-detail-icon-color: $item-md-border-color !default; $item-md-detail-icon-color: $item-md-border-color !default;

View File

@ -24,4 +24,24 @@ test.describe('thumbnail: basic', () => {
await expect(referenceEl).toHaveScreenshot(`thumbnail-ion-item-diff-${page.getSnapshotSettings()}.png`); await expect(referenceEl).toHaveScreenshot(`thumbnail-ion-item-diff-${page.getSnapshotSettings()}.png`);
}); });
test('size should be customizable in <ion-item>', async ({ page, skip }) => {
skip.rtl();
test.info().annotations.push({
type: 'issue',
description: 'https://github.com/ionic-team/ionic-framework/issues/22935',
});
await page.setContent(`
<ion-item>
<ion-thumbnail style="--size: 20px">
<img src="/src/components/thumbnail/test/thumbnail.svg" />
</ion-thumbnail>
</ion-item>
`);
const item = page.locator('ion-item');
await expect(item).toHaveScreenshot(`thumbnail-ion-item-size-diff-${page.getSnapshotSettings()}.png`);
});
}); });