|
87 | 87 | --str-chat__message-with-attachment-max-width: calc(var(--str-chat__spacing-px) * 300); |
88 | 88 | } |
89 | 89 |
|
| 90 | +/* Make spaces between message groups */ |
| 91 | +.str-chat__li--top { |
| 92 | + padding-block-start: var(--spacing-xs); |
| 93 | + padding-block-end: var(--spacing-xxxs); |
| 94 | +} |
| 95 | + |
| 96 | +.str-chat__li--bottom { |
| 97 | + padding-block-start: var(--spacing-xxxs); |
| 98 | + padding-block-end: var(--spacing-xs); |
| 99 | +} |
| 100 | + |
| 101 | +.str-chat__li--middle { |
| 102 | + padding-block: var(--spacing-xxxs); |
| 103 | +} |
| 104 | + |
| 105 | +.str-chat__li--single { |
| 106 | + padding-block: var(--spacing-xs); |
| 107 | +} |
| 108 | + |
90 | 109 | .str-chat__message { |
91 | 110 | --str-chat-message-options-size: calc(3 * var(--str-chat__message-options-button-size)); |
| 111 | + padding-inline: var(--str-chat__message-composer-padding); |
92 | 112 |
|
93 | 113 | &.str-chat__message-without-touch-support { |
94 | 114 | --str-chat-message-options-size: calc( |
|
214 | 234 |
|
215 | 235 | .str-chat__message-reminder { |
216 | 236 | grid-area: message-reminder; |
217 | | - padding-block: var(--str-chat__spacing-2) var(--str-chat__spacing-0_5); |
| 237 | + padding-block: var(--spacing-xxs); |
218 | 238 | margin: 0; |
219 | 239 | @include utils.component-layer-overrides('message-reminder'); |
220 | 240 | font: var(--str-chat__caption-medium-text); |
221 | 241 | } |
222 | 242 |
|
| 243 | + @mixin message-grid-no-avatar { |
| 244 | + grid-template-areas: |
| 245 | + 'pin-indicator' |
| 246 | + 'message-reminder' |
| 247 | + 'message' |
| 248 | + 'translation-notice' |
| 249 | + 'custom-metadata' |
| 250 | + 'metadata'; |
| 251 | + grid-template-columns: 1fr; |
| 252 | + } |
| 253 | + |
| 254 | + @mixin message-grid-other-with-avatar { |
| 255 | + grid-template-areas: |
| 256 | + '. pin-indicator' |
| 257 | + '. message-reminder' |
| 258 | + 'avatar message' |
| 259 | + 'avatar translation-notice' |
| 260 | + 'avatar custom-metadata' |
| 261 | + 'avatar metadata'; |
| 262 | + grid-template-columns: auto 1fr; |
| 263 | + } |
| 264 | + |
| 265 | + @mixin message-grid-me-with-avatar { |
| 266 | + grid-template-areas: |
| 267 | + 'pin-indicator .' |
| 268 | + 'message-reminder .' |
| 269 | + 'message avatar' |
| 270 | + 'translation-notice avatar' |
| 271 | + 'custom-metadata avatar' |
| 272 | + 'metadata avatar'; |
| 273 | + grid-template-columns: 1fr auto; |
| 274 | + } |
| 275 | + |
223 | 276 | .str-chat__message-pin-indicator { |
224 | 277 | grid-area: pin-indicator; |
225 | 278 | padding-block: var(--spacing-xxs); |
|
238 | 291 | } |
239 | 292 |
|
240 | 293 | &.str-chat__message--other { |
241 | | - grid-template-areas: |
242 | | - '. message-reminder' |
243 | | - 'avatar message' |
244 | | - 'avatar translation-notice' |
245 | | - 'avatar custom-metadata' |
246 | | - 'avatar metadata'; |
247 | 294 | column-gap: var(--str-chat__spacing-2); |
248 | | - grid-template-columns: auto 1fr; |
249 | 295 | justify-items: flex-start; |
250 | 296 |
|
| 297 | + &.str-chat__message--with-avatar { |
| 298 | + @include message-grid-other-with-avatar; |
| 299 | + } |
| 300 | + |
| 301 | + &:not(.str-chat__message--with-avatar) { |
| 302 | + @include message-grid-no-avatar; |
| 303 | + } |
| 304 | + |
251 | 305 | .str-chat__message-inner { |
252 | 306 | .str-chat__message-reactions-host { |
253 | 307 | justify-self: flex-start; |
|
268 | 322 | } |
269 | 323 |
|
270 | 324 | &.str-chat__message--pinned.str-chat__message--other { |
271 | | - grid-template-areas: |
272 | | - '. pin-indicator' |
273 | | - '. message-reminder' |
274 | | - 'avatar message' |
275 | | - 'avatar translation-notice' |
276 | | - 'avatar custom-metadata' |
277 | | - 'avatar metadata'; |
| 325 | + @include message-grid-other-with-avatar; |
278 | 326 | } |
279 | 327 |
|
280 | 328 | &.str-chat__message--pinned.str-chat__message--me { |
281 | | - grid-template-areas: |
282 | | - 'pin-indicator .' |
283 | | - 'message-reminder .' |
284 | | - 'message avatar' |
285 | | - 'translation-notice avatar' |
286 | | - 'custom-metadata avatar' |
287 | | - 'metadata avatar'; |
| 329 | + @include message-grid-me-with-avatar; |
288 | 330 | } |
289 | 331 |
|
290 | 332 | &.str-chat__message--me { |
291 | | - grid-template-areas: |
292 | | - 'message-reminder .' |
293 | | - 'message avatar' |
294 | | - 'translation-notice avatar' |
295 | | - 'custom-metadata avatar' |
296 | | - 'metadata avatar'; |
297 | 333 | column-gap: var(--str-chat__spacing-2); |
298 | | - grid-template-columns: 1fr auto; |
299 | 334 | justify-items: flex-end; |
300 | 335 |
|
| 336 | + &.str-chat__message--with-avatar { |
| 337 | + @include message-grid-me-with-avatar; |
| 338 | + } |
| 339 | + |
| 340 | + &:not(.str-chat__message--with-avatar) { |
| 341 | + @include message-grid-no-avatar; |
| 342 | + } |
| 343 | + |
301 | 344 | .str-chat__message-inner { |
302 | 345 | .str-chat__message-reactions-host { |
303 | 346 | justify-self: flex-end; |
|
315 | 358 | } |
316 | 359 | } |
317 | 360 | } |
| 361 | + |
318 | 362 | } |
319 | 363 |
|
320 | 364 | &.str-chat__message--deleted { |
|
335 | 379 | align-self: end; |
336 | 380 | } |
337 | 381 |
|
338 | | - &.str-chat__message--me .str-chat__avatar:has(~ .str-chat__message-inner) { |
| 382 | + &:not(.str-chat__message--with-avatar) .str-chat__avatar { |
339 | 383 | display: none; |
340 | 384 | } |
341 | 385 |
|
|
660 | 704 | .str-chat__li--middle, |
661 | 705 | .str-chat__li--top { |
662 | 706 | .str-chat__message { |
663 | | - // space below the message within a group |
664 | | - padding-block-end: var(--spacing-xxs); |
665 | | - |
666 | 707 | .str-chat__message-metadata { |
667 | 708 | display: none; |
668 | 709 | } |
669 | 710 |
|
670 | | - // > selector added to not hide sender of inline replies |
671 | | - > .str-chat__message-sender-avatar { |
| 711 | + // Hide sender avatar in middle/top of group (only show on last message in group) |
| 712 | + > .str-chat__avatar { |
672 | 713 | visibility: hidden; |
673 | 714 | } |
674 | 715 | } |
675 | 716 | } |
676 | 717 |
|
677 | | -.str-chat__li--top, |
678 | | -.str-chat__li--single { |
679 | | - .str-chat__message { |
680 | | - // space above the message group |
681 | | - padding-block-start: var(--spacing-xs); |
682 | | - } |
683 | | -} |
684 | | - |
685 | | -.str-chat__li--bottom, |
686 | | -.str-chat__li--single { |
687 | | - .str-chat__message { |
688 | | - // space below the message group |
689 | | - padding-block-end: var(--spacing-xs); |
690 | | - } |
691 | | -} |
692 | | - |
693 | 718 | .str-chat__li--single, |
694 | 719 | .str-chat__li--bottom { |
695 | 720 | .str-chat__message--other { |
|
729 | 754 | // Avatar display in message list |
730 | 755 | .str-chat__li--top, |
731 | 756 | .str-chat__li--middle { |
732 | | - .str-chat__message > .str-chat__avatar { |
| 757 | + .str-chat__message.str-chat__message--with-avatar > .str-chat__avatar { |
733 | 758 | visibility: hidden; |
734 | 759 | pointer-events: none; |
735 | 760 | } |
|
0 commit comments