diff --git a/src/components/Attachment/Giphy.tsx b/src/components/Attachment/Giphy.tsx index 4d9807e571..d7969a43f8 100644 --- a/src/components/Attachment/Giphy.tsx +++ b/src/components/Attachment/Giphy.tsx @@ -1,10 +1,14 @@ import type { Attachment } from 'stream-chat'; +import { BaseImage as DefaultBaseImage } from '../BaseImage'; import { toGalleryItemDescriptors } from '../Gallery'; import clsx from 'clsx'; -import { useChannelStateContext } from '../../context'; +import { + useChannelStateContext, + useComponentContext, + useTranslationContext, +} from '../../context'; import { IconGiphy } from '../Icons'; import { useMemo } from 'react'; -import { ImageComponent } from './Image'; export type GiphyAttachmentProps = { attachment: Attachment; @@ -12,17 +16,28 @@ export type GiphyAttachmentProps = { export const Giphy = ({ attachment }: GiphyAttachmentProps) => { const { giphyVersion: giphyVersionName } = useChannelStateContext(); + const { BaseImage = DefaultBaseImage } = useComponentContext(); + const { t } = useTranslationContext(); + const usesDefaultBaseImage = BaseImage === DefaultBaseImage; const imageDescriptors = useMemo( () => toGalleryItemDescriptors(attachment, { giphyVersionName }), [attachment, giphyVersionName], ); - if (!imageDescriptors) return null; + if (!imageDescriptors?.imageUrl) return null; + + const { alt, dimensions, imageUrl, title } = imageDescriptors; return (