Skip to content

Commit f36ab67

Browse files
committed
fix: align slots in message composer previews
1 parent 914950c commit f36ab67

4 files changed

Lines changed: 21 additions & 16 deletions

File tree

src/components/MessageInput/AttachmentPreviewList/AttachmentPreviewList.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ComponentType } from 'react';
1+
import { type ComponentType, useMemo } from 'react';
22
import React from 'react';
33
import {
44
isLocalAttachment,
@@ -8,6 +8,7 @@ import {
88
isLocalVideoAttachment,
99
isLocalVoiceRecordingAttachment,
1010
isScrapedContent,
11+
isVoiceRecordingAttachment,
1112
} from 'stream-chat';
1213
import {
1314
UnsupportedAttachmentPreview as DefaultUnknownAttachmentPreview,
@@ -53,15 +54,15 @@ export const AttachmentPreviewList = ({
5354

5455
// todo: we could also allow to attach poll to a message composition
5556
const { attachments, location } = useAttachmentsForPreview();
57+
const filteredAttachments = useMemo(
58+
() => attachments.filter((a) => !isVoiceRecordingAttachment(a)),
59+
[attachments],
60+
);
5661

57-
if (!attachments.length && !location) return null;
62+
if (!filteredAttachments.length && !location) return null;
5863

5964
return (
6065
<div className='str-chat__attachment-preview-list'>
61-
{/*<div*/}
62-
{/* className='str-chat__attachment-list-scroll-container'*/}
63-
{/* data-testid='attachment-list-scroll-container'*/}
64-
{/*>*/}
6566
{location && (
6667
<GeolocationPreview
6768
location={location}
@@ -126,7 +127,6 @@ export const AttachmentPreviewList = ({
126127
}
127128
return null;
128129
})}
129-
{/*</div>*/}
130130
</div>
131131
);
132132
};

src/components/MessageInput/QuotedMessagePreview.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,14 @@ export const QuotedMessagePreview = ({
253253
);
254254

255255
return quotedMessage ? (
256-
<QuotedMessagePreviewUI
257-
getQuotedMessageAuthor={getQuotedMessageAuthor}
258-
onRemove={() => messageComposer.setQuotedMessage(null)}
259-
quotedMessage={quotedMessage}
260-
renderText={renderText}
261-
/>
256+
<div className='str-chat__message-composer__quoted-message-preview-slot'>
257+
<QuotedMessagePreviewUI
258+
getQuotedMessageAuthor={getQuotedMessageAuthor}
259+
onRemove={() => messageComposer.setQuotedMessage(null)}
260+
quotedMessage={quotedMessage}
261+
renderText={renderText}
262+
/>
263+
</div>
262264
) : null;
263265
};
264266

src/components/MessageInput/styling/MessageComposer.scss

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,14 @@
6363
flex-direction: column;
6464
width: 100%;
6565
min-width: 0;
66-
padding-inline: var(--spacing-xs);
67-
padding-block: var(--spacing-sm);
6866
@include utils.component-layer-overrides('message-input');
6967
}
7068

7169
.str-chat__message-composer-previews {
7270
display: flex;
7371
flex-direction: column;
7472
width: 100%;
75-
padding-bottom: var(--spacing-xs);
73+
padding: var(--spacing-xs) var(--spacing-xs) 0;
7674
gap: var(--spacing-xxs);
7775

7876
min-width: 0;
@@ -83,6 +81,7 @@
8381
align-items: end;
8482
width: 100%;
8583
gap: var(--spacing-xs);
84+
padding: var(--spacing-sm);
8685

8786
$controls-containers-min-height: 26px;
8887

src/components/MessageInput/styling/QuotedMessagePreview.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
@use '../../../styling/utils';
22

33
.str-chat {
4+
.str-chat__message-composer__quoted-message-preview-slot {
5+
padding: var(--spacing-xxs);
6+
}
7+
48
.str-chat__quoted-message-preview {
59
display: flex;
610
align-items: center;

0 commit comments

Comments
 (0)