Skip to content

Commit 6cecdf4

Browse files
thetaPCIonitronliamdebeasi
authoredMar 24, 2023
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>
1 parent 3b99c31 commit 6cecdf4

12 files changed

+34
-21
lines changed
 

‎core/src/components/item-divider/item-divider.md.scss

+1-3
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,11 @@
9696
height: $item-md-avatar-height;
9797
}
9898

99-
10099
// Material Design Item Divider Thumbnail
101100
// --------------------------------------------------
102101

103102
::slotted(ion-thumbnail) {
104-
width: $item-md-thumbnail-width;
105-
height: $item-md-thumbnail-height;
103+
--size: #{$item-md-thumbnail-size};
106104
}
107105

108106
// Material Design Item Divider Avatar/Thumbnail

‎core/src/components/item/item.ios.scss

+8-4
Original file line numberDiff line numberDiff line change
@@ -154,20 +154,24 @@
154154
font-size: 13px;
155155
}
156156

157-
158-
// iOS Item Avatar & Thumbnail
157+
// iOS Item Avatar
159158
// --------------------------------------------------
160159

161160
::slotted(ion-avatar) {
162161
width: $item-ios-avatar-width;
163162
height: $item-ios-avatar-height;
164163
}
165164

165+
// iOS Item Thumbnail
166+
// --------------------------------------------------
167+
166168
::slotted(ion-thumbnail) {
167-
width: $item-ios-thumbnail-width;
168-
height: $item-ios-thumbnail-height;
169+
--size: #{$item-ios-thumbnail-size};
169170
}
170171

172+
// iOS Item Avatar/Thumbnail
173+
// --------------------------------------------------
174+
171175
::slotted(ion-avatar[slot="end"]),
172176
::slotted(ion-thumbnail[slot="end"]) {
173177
@include margin(($item-ios-padding-end * 0.5));

‎core/src/components/item/item.ios.vars.scss

+2-5
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,8 @@ $item-ios-avatar-width: 36px !default;
3333
/// @prop - Height of the avatar in the item
3434
$item-ios-avatar-height: $item-ios-avatar-width !default;
3535

36-
/// @prop - Width of the thumbnail in the item
37-
$item-ios-thumbnail-width: 56px !default;
38-
39-
/// @prop - Height of the thumbnail in the item
40-
$item-ios-thumbnail-height: $item-ios-thumbnail-width !default;
36+
/// @prop - Size of the thumbnail in the item
37+
$item-ios-thumbnail-size: 56px !default;
4138

4239
/// @prop - Color of the detail arrow icon
4340
$item-ios-detail-icon-color: $item-ios-border-color !default;

‎core/src/components/item/item.md.scss

+1-4
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@
258258
@include padding-horizontal($item-md-note-end-slot-padding-start, $item-md-note-end-slot-padding-end);
259259
}
260260

261-
262261
// Material Design Item Avatar
263262
// --------------------------------------------------
264263

@@ -267,13 +266,11 @@
267266
height: $item-md-avatar-height;
268267
}
269268

270-
271269
// Material Design Item Thumbnail
272270
// --------------------------------------------------
273271

274272
::slotted(ion-thumbnail) {
275-
width: $item-md-thumbnail-width;
276-
height: $item-md-thumbnail-height;
273+
--size: #{$item-md-thumbnail-size};
277274
}
278275

279276
// Material Design Item Avatar/Thumbnail

‎core/src/components/item/item.md.vars.scss

+2-5
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,8 @@ $item-md-avatar-width: 40px !default;
1818
/// @prop - Height of the avatar in the item
1919
$item-md-avatar-height: $item-md-avatar-width !default;
2020

21-
/// @prop - Width of the thumbnail in the item
22-
$item-md-thumbnail-width: 56px !default;
23-
24-
/// @prop - Height of the thumbnail in the item
25-
$item-md-thumbnail-height: $item-md-thumbnail-width !default;
21+
/// @prop - Size of the thumbnail in the item
22+
$item-md-thumbnail-size: 56px !default;
2623

2724
/// @prop - Color of the detail arrow icon
2825
$item-md-detail-icon-color: $item-md-border-color !default;

‎core/src/components/thumbnail/test/basic/thumbnail.e2e.ts

+20
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,24 @@ test.describe('thumbnail: basic', () => {
2424

2525
await expect(referenceEl).toHaveScreenshot(`thumbnail-ion-item-diff-${page.getSnapshotSettings()}.png`);
2626
});
27+
28+
test('size should be customizable in <ion-item>', async ({ page, skip }) => {
29+
skip.rtl();
30+
31+
test.info().annotations.push({
32+
type: 'issue',
33+
description: 'https://github.com/ionic-team/ionic-framework/issues/22935',
34+
});
35+
36+
await page.setContent(`
37+
<ion-item>
38+
<ion-thumbnail style="--size: 20px">
39+
<img src="/src/components/thumbnail/test/thumbnail.svg" />
40+
</ion-thumbnail>
41+
</ion-item>
42+
`);
43+
44+
const item = page.locator('ion-item');
45+
await expect(item).toHaveScreenshot(`thumbnail-ion-item-size-diff-${page.getSnapshotSettings()}.png`);
46+
});
2747
});

0 commit comments

Comments
 (0)
Please sign in to comment.