Skip to content

Commit

Permalink
fix: do not generate class names to contain string 'undefined', do no…
Browse files Browse the repository at this point in the history
…t pass Media prop to Card
  • Loading branch information
MartinCupela committed Jul 8, 2022
1 parent 2e983d0 commit 40342fe
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/components/Attachment/AttachmentContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ export const AttachmentWithinContainer = <

const classNames = clsx(
'str-chat__message-attachment',
`str-chat__message-attachment--${componentType}`,
componentType && `str-chat__message-attachment--${componentType}`,
attachment?.type && `str-chat__message-attachment--${attachment?.type}`,
extra && `str-chat__message-attachment--${componentType}--${extra}`,
componentType && extra && `str-chat__message-attachment--${componentType}--${extra}`,
extra === 'actions' && 'str-chat__message-attachment-with-actions', // added for theme V2 (better readability)
);

Expand Down Expand Up @@ -116,14 +116,14 @@ export const CardContainer = <
>(
props: RenderAttachmentProps<StreamChatGenerics>,
) => {
const { attachment, Media, Card = DefaultCard } = props;
const { attachment, Card = DefaultCard } = props;
const componentType = 'card';

if (attachment.actions && attachment.actions.length) {
return (
<AttachmentWithinContainer attachment={attachment} componentType={componentType}>
<div className='str-chat__attachment' key={`key-image-${attachment.id}`}>
<Card {...attachment} Media={Media} />
<Card {...attachment} />
<AttachmentActionsContainer {...props} />
</div>
</AttachmentWithinContainer>
Expand All @@ -132,7 +132,7 @@ export const CardContainer = <

return (
<AttachmentWithinContainer attachment={attachment} componentType={componentType}>
<Card {...attachment} Media={Media} />
<Card {...attachment} />
</AttachmentWithinContainer>
);
};
Expand Down

0 comments on commit 40342fe

Please sign in to comment.