Skip to content

Commit 98ceb7b

Browse files
committed
fix: prevent images being squashed in narrow message lists
1 parent a613190 commit 98ceb7b

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

src/components/Attachment/styling/LinkPreview.scss

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,17 @@
9090
padding: 0;
9191

9292
img {
93-
height: var(--str-chat__scraped-image-height);
93+
aspect-ratio: 1.91 / 1;
9494
width: 100%;
95+
height: auto;
96+
// CDN resize requires max-height to be present on this element
97+
max-height: var(--str-chat__scraped-image-height);
9598
border-radius: 0;
9699
}
97100

98101
.str-chat__message-attachment-card--header:has(.str-chat__image-placeholder) {
99-
height: var(--str-chat__scraped-image-height);
102+
aspect-ratio: 1.91 / 1;
103+
height: auto;
100104

101105
.str-chat__image-placeholder {
102106
border-radius: 0;

src/components/Attachment/styling/ModalGallery.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@
1919
border-radius: var(--str-chat__radius-lg);
2020
gap: var(--str-chat__space-2);
2121
width: $max-width;
22-
max-width: $max-width;
23-
// CDN resize requires height/max-height to be present on the img element, this rule ensures that
24-
height: var(--str-chat__attachment-max-width);
22+
max-width: 100%;
23+
aspect-ratio: 4 / 3;
2524

2625
.str-chat__modal-gallery__image {
2726
width: 100%;
@@ -97,8 +96,9 @@
9796
height: 100%;
9897
object-fit: cover;
9998
cursor: zoom-in;
100-
// CDN resize requires max-width to be present on this element
99+
// CDN resize requires max-width and max-height to be present on this element
101100
max-width: $max-width;
101+
max-height: $max-width;
102102
transition: opacity 150ms ease-in-out;
103103
}
104104

0 commit comments

Comments
 (0)