|
1 | 1 | @use '../../../styling/utils'; |
2 | 2 |
|
3 | 3 | .str-chat__attachment-list { |
4 | | - .str-chat__message-attachment--gallery { |
| 4 | + .str-chat__message-attachment--gallery, |
| 5 | + .str-chat__message-attachment--image { |
5 | 6 | $max-width: var(--str-chat__attachment-max-width); |
| 7 | + min-width: 0; |
| 8 | + max-width: 100%; |
6 | 9 |
|
7 | 10 | .str-chat__modal-gallery { |
8 | | - background: transparent; |
| 11 | + background-color: var(--chat-bg); |
9 | 12 | color: var(--str-chat__text-primary); |
10 | 13 | border-radius: calc( |
11 | 14 | var(--str-chat__message-bubble-radius-group-bottom) - var( |
12 | 15 | --str-chat__attachment-margin |
13 | 16 | ) |
14 | 17 | ); |
15 | 18 | display: grid; |
16 | | - grid-template-columns: 50% 50%; |
17 | | - grid-template-rows: 50% 50%; |
| 19 | + grid-template-columns: 1fr 1fr; |
| 20 | + grid-template-rows: 1fr 1fr; |
18 | 21 | overflow: hidden; |
19 | 22 | border-radius: var(--str-chat__radius-lg); |
20 | | - gap: var(--str-chat__space-2); |
| 23 | + gap: var(--str-chat__spacing-xxs); |
21 | 24 | 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); |
| 25 | + max-width: 100%; |
| 26 | + aspect-ratio: 4 / 3; |
| 27 | + |
| 28 | + $outer-radius: var(--str-chat__radius-lg); |
| 29 | + $inner-radius: var(--str-chat__radius-md); |
25 | 30 |
|
26 | 31 | .str-chat__modal-gallery__image { |
27 | 32 | width: 100%; |
28 | 33 | height: 100%; |
29 | 34 | min-width: 0; |
30 | 35 | min-height: 0; |
| 36 | + border-radius: $inner-radius; |
| 37 | + |
| 38 | + &.str-chat__modal-gallery__image--loading, |
| 39 | + &.str-chat__modal-gallery__image--load-failed { |
| 40 | + min-height: 0; |
| 41 | + } |
| 42 | + |
| 43 | + &:only-child { |
| 44 | + grid-column: 1 / -1; |
| 45 | + grid-row: 1 / -1; |
| 46 | + border-radius: $outer-radius; |
| 47 | + } |
| 48 | + |
| 49 | + &:nth-child(1) { |
| 50 | + border-start-start-radius: $outer-radius; |
| 51 | + } |
| 52 | + &:nth-child(2) { |
| 53 | + border-start-end-radius: $outer-radius; |
| 54 | + } |
| 55 | + &:nth-child(3) { |
| 56 | + border-end-start-radius: $outer-radius; |
| 57 | + } |
| 58 | + &:nth-child(4) { |
| 59 | + border-end-end-radius: $outer-radius; |
| 60 | + } |
31 | 61 | } |
32 | 62 |
|
33 | 63 | &.str-chat__modal-gallery--two-images { |
34 | 64 | grid-template-rows: 1fr; |
| 65 | + |
| 66 | + .str-chat__modal-gallery__image:nth-child(1) { |
| 67 | + border-end-start-radius: $outer-radius; |
| 68 | + } |
| 69 | + |
| 70 | + .str-chat__modal-gallery__image:nth-child(2) { |
| 71 | + border-end-end-radius: $outer-radius; |
| 72 | + } |
35 | 73 | } |
36 | 74 |
|
37 | 75 | &.str-chat__modal-gallery--three-images { |
38 | 76 | .str-chat__modal-gallery__image:nth-child(1) { |
39 | 77 | grid-column: 1; |
40 | | - grid-row: 1 / span 2; /* Span two rows */ |
| 78 | + grid-row: 1 / span 2; |
| 79 | + border-end-start-radius: $outer-radius; |
41 | 80 | } |
42 | 81 |
|
43 | 82 | .str-chat__modal-gallery__image:nth-child(2) { |
44 | 83 | grid-column: 2; |
45 | 84 | grid-row: 1; |
| 85 | + border-start-end-radius: $outer-radius; |
46 | 86 | } |
47 | 87 |
|
48 | 88 | .str-chat__modal-gallery__image:nth-child(3) { |
49 | 89 | grid-column: 2; |
50 | 90 | grid-row: 2; |
| 91 | + border-end-end-radius: $outer-radius; |
51 | 92 | } |
52 | 93 | } |
53 | 94 |
|
|
97 | 138 | height: 100%; |
98 | 139 | object-fit: cover; |
99 | 140 | cursor: zoom-in; |
100 | | - // CDN resize requires max-width to be present on this element |
| 141 | + // CDN resize requires max-width and max-height to be present on this element |
101 | 142 | max-width: $max-width; |
| 143 | + max-height: $max-width; |
102 | 144 | transition: opacity 150ms ease-in-out; |
103 | 145 | } |
104 | 146 |
|
105 | 147 | &.str-chat__modal-gallery__image--loading { |
| 148 | + min-height: 200px; |
| 149 | + align-items: stretch; |
| 150 | + |
106 | 151 | img { |
| 152 | + position: absolute; |
107 | 153 | opacity: 0; |
108 | 154 | } |
| 155 | + |
| 156 | + .str-chat__modal-gallery__image-loading-overlay { |
| 157 | + position: static; |
| 158 | + flex: 1; |
| 159 | + min-width: 0; |
| 160 | + height: auto; |
| 161 | + } |
109 | 162 | } |
110 | 163 |
|
111 | 164 | &.str-chat__modal-gallery__image--load-failed { |
112 | 165 | cursor: pointer; |
113 | 166 | min-height: 200px; |
| 167 | + align-items: stretch; |
114 | 168 |
|
115 | 169 | .str-chat__image-placeholder.str-chat__base-image--load-failed { |
116 | | - width: 100%; |
117 | | - min-height: 200px; |
118 | | - align-self: stretch; |
| 170 | + flex: 1; |
| 171 | + min-width: 0; |
| 172 | + height: auto; |
119 | 173 | } |
120 | 174 |
|
121 | 175 | img { |
|
139 | 193 | display: flex; |
140 | 194 | align-items: center; |
141 | 195 | justify-content: center; |
142 | | - background-color: var(--chat-bg); |
| 196 | + background-color: var(--str-chat__background-core-overlay-light); |
143 | 197 | background-image: linear-gradient( |
144 | 198 | 90deg, |
145 | 199 | var(--str-chat__skeleton-loading-base) 0%, |
|
0 commit comments