diff --git a/src/components/MessageInput/AttachmentPreviewList/AttachmentPreviewList.tsx b/src/components/MessageInput/AttachmentPreviewList/AttachmentPreviewList.tsx index 14b630402..fb9271f0f 100644 --- a/src/components/MessageInput/AttachmentPreviewList/AttachmentPreviewList.tsx +++ b/src/components/MessageInput/AttachmentPreviewList/AttachmentPreviewList.tsx @@ -62,7 +62,10 @@ export const AttachmentPreviewList = ({ if (!filteredAttachments.length && !location) return null; return ( -
+
{location && ( > = - UploadAttachmentPreviewProps>; diff --git a/src/components/MessageInput/AttachmentPreviewList/VoiceRecordingPreviewSlot.tsx b/src/components/MessageInput/AttachmentPreviewList/VoiceRecordingPreviewSlot.tsx index 21a586e1c..872c3e607 100644 --- a/src/components/MessageInput/AttachmentPreviewList/VoiceRecordingPreviewSlot.tsx +++ b/src/components/MessageInput/AttachmentPreviewList/VoiceRecordingPreviewSlot.tsx @@ -1,9 +1,15 @@ import type { ComponentType } from 'react'; import React from 'react'; -import { isLocalVoiceRecordingAttachment } from 'stream-chat'; +import { + isLocalVoiceRecordingAttachment, + type LocalVoiceRecordingAttachment, +} from 'stream-chat'; import { useAttachmentsForPreview, useMessageComposer } from '../hooks'; import { AudioAttachmentPreview } from './AudioAttachmentPreview'; -import type { VoiceRecordingPreviewProps } from './VoiceRecordingPreview'; +import type { UploadAttachmentPreviewProps } from './types'; + +export type VoiceRecordingPreviewProps> = + UploadAttachmentPreviewProps>; export type VoiceRecordingPreviewSlotProps = { /** Custom UI component for each voice recording preview in the slot; defaults to AudioAttachmentPreview */ diff --git a/src/components/MessageInput/AttachmentPreviewList/index.ts b/src/components/MessageInput/AttachmentPreviewList/index.ts index 79f1c566a..ab116ba5b 100644 --- a/src/components/MessageInput/AttachmentPreviewList/index.ts +++ b/src/components/MessageInput/AttachmentPreviewList/index.ts @@ -6,8 +6,8 @@ export type { ImageAttachmentPreviewProps } from './ImageAttachmentPreview'; export type { UploadAttachmentPreviewProps as AttachmentPreviewProps } from './types'; export type { UnsupportedAttachmentPreviewProps } from './UnsupportedAttachmentPreview'; export type { MediaAttachmentPreviewProps } from './MediaAttachmentPreview'; -export type { VoiceRecordingPreviewProps } from './VoiceRecordingPreview'; export { VoiceRecordingPreviewSlot, + type VoiceRecordingPreviewProps, type VoiceRecordingPreviewSlotProps, } from './VoiceRecordingPreviewSlot'; diff --git a/src/components/MessageInput/RemoveAttachmentPreviewButton.tsx b/src/components/MessageInput/RemoveAttachmentPreviewButton.tsx index ae3964bf7..42a81328b 100644 --- a/src/components/MessageInput/RemoveAttachmentPreviewButton.tsx +++ b/src/components/MessageInput/RemoveAttachmentPreviewButton.tsx @@ -15,14 +15,11 @@ export const RemoveAttachmentPreviewButton = ({ const { t } = useTranslationContext(); return ( + image-upload-1
@@ -82,50 +68,54 @@ exports[`AttachmentPreviewList should render custom BaseImage component 1`] = `
- image-upload-1
-
- +
+ +
+
+
+ image-upload-2
@@ -156,14 +146,28 @@ exports[`AttachmentPreviewList should render custom BaseImage component 1`] = `
- image-upload-2
+
diff --git a/src/components/MessageInput/styling/AttachmentPreview.scss b/src/components/MessageInput/styling/AttachmentPreview.scss index f612b6b3f..74f2a0065 100644 --- a/src/components/MessageInput/styling/AttachmentPreview.scss +++ b/src/components/MessageInput/styling/AttachmentPreview.scss @@ -14,8 +14,11 @@ --str-chat__attachment-preview-list-border-inline-end: none; --str-chat__attachment-preview-list-box-shadow: none; - --str-chat__attachment-preview-close-icon-background: var(--base-black); - --str-chat__attachment-preview-close-icon-color: var(--control-remove-control-border); + --str-chat__attachment-preview-close-icon-background: var(--control-remove-control-bg); + --str-chat__attachment-preview-close-icon-color: var(--control-remove-control-icon); + --str-chat__attachment-preview-close-icon-border-color: var( + --control-remove-control-border + ); --str-chat__attachment-preview-retry-icon-color: var(--str-chat__primary-color); --str-chat__attachment-preview-download-icon-color: var(--text-secondary); --str-chat__attachment-preview-overlay-color: var(--background-core-overlay); @@ -95,16 +98,15 @@ @include utils.component-layer-overrides('attachment-preview-list'); padding: var(--spacing-xxs); display: flex; - align-items: center; - //justify-content: center; + align-items: flex-start; + align-content: flex-start; + flex-wrap: wrap; justify-content: flex-start; width: 100%; - min-width: 0; max-width: 100%; - overflow-x: auto; - flex: 1 1 auto; - overflow-y: hidden; + overflow: visible; + flex: 0 0 auto; gap: var(--spacing-md); } @@ -115,11 +117,11 @@ @include utils.component-layer-overrides('attachment-preview-file'); display: flex; align-items: center; + flex: 0 1 auto; gap: var(--spacing-sm); padding: var(--spacing-md); padding-right: var(--spacing-sm); - min-width: 224px; - max-width: 280px; + width: 290px; } .str-chat__attachment-preview-audio { @@ -161,6 +163,7 @@ .str-chat__attachment-preview-media { @include utils.component-layer-overrides('attachment-preview-image'); + flex: 0 0 auto; width: 72px; height: 72px; cursor: pointer; @@ -283,7 +286,8 @@ .str-chat__attachment-preview-file__data { display: flex; align-items: center; - width: 160px; + width: min(160px, 100%); + max-width: 100%; gap: var(--spacing-xxs); color: var(--text-secondary); font-weight: var(--typography-font-weight-regular); diff --git a/src/components/MessageInput/styling/RemoveAttachmentPreviewButton.scss b/src/components/MessageInput/styling/RemoveAttachmentPreviewButton.scss index cbd2673a1..1d0e4d854 100644 --- a/src/components/MessageInput/styling/RemoveAttachmentPreviewButton.scss +++ b/src/components/MessageInput/styling/RemoveAttachmentPreviewButton.scss @@ -1,11 +1,10 @@ .str-chat__button.str-chat__attachment-preview__remove-button { position: absolute; z-index: 1; - // todo: do we need semantic variable here? top: -6px; right: -6px; background-color: var(--str-chat__attachment-preview-close-icon-background); - border: 3px solid var(--str-chat__attachment-preview-close-icon-color); + border: 3px solid var(--str-chat__attachment-preview-close-icon-border-color); color: var(--str-chat__attachment-preview-close-icon-color); border-radius: var(--radius-max);