Skip to content

Commit

Permalink
fix(chatscope#76): rendering lastSenderName as a ReactNode
Browse files Browse the repository at this point in the history
  • Loading branch information
supersnager committed Nov 16, 2022
1 parent 9d41285 commit 20d09fd
Showing 1 changed file with 27 additions and 17 deletions.
44 changes: 27 additions & 17 deletions src/components/Conversation/ConversationContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,33 @@ export const ConversationContent = ({
children,
className,
...rest
}) => (
<div {...rest} className={classNames(`${cName}__content`, className)}>
{React.Children.count(children) > 0 ? (
children
) : (
<>
<div className={`${cName}__name`}>{name}</div>
<div className={`${cName}__info`}>
{typeof lastSenderName === "string" && (
<LastSenderName name={lastSenderName} />
)}{" "}
{typeof info !== "undefined" && <InfoContent info={info} />}
</div>
</>
)}
</div>
);
}) => {
const typeofLastSenderName = typeof lastSenderName;

return (
<div {...rest} className={classNames(`${cName}__content`, className)}>
{React.Children.count(children) > 0 ? (
children
) : (
<>
<div className={`${cName}__name`}>{name}</div>
<div className={`${cName}__info`}>
{typeofLastSenderName !== "undefined" ? (
<>
{typeofLastSenderName === "string" ? (
<LastSenderName name={lastSenderName} />
) : (
lastSenderName
)}{" "}
</>
) : null}
{typeof info !== "undefined" && <InfoContent info={info} />}
</div>
</>
)}
</div>
);
};

ConversationContent.displayName = "Conversation.Content";

Expand Down

0 comments on commit 20d09fd

Please sign in to comment.