Skip to content

Commit

Permalink
fix(post): expand button didn't appear for text with webpage link
Browse files Browse the repository at this point in the history
  • Loading branch information
plebeius-eth committed Nov 11, 2024
1 parent b367051 commit 80fcc58
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/components/post/expand-button/expand-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ interface ExpandButtonProps {
}

const ExpandButton = ({ commentMediaInfo, content, expanded, hasThumbnail, link, toggleExpanded }: ExpandButtonProps) => {
const initialButtonType = hasThumbnail || commentMediaInfo?.type === 'audio' || commentMediaInfo?.type === 'iframe' ? 'playButton' : 'textButton';
let initialButtonType = hasThumbnail || commentMediaInfo?.type === 'audio' || commentMediaInfo?.type === 'iframe' ? 'playButton' : 'textButton';

if (commentMediaInfo?.type === 'webpage' && content && content.trim().length > 0) {
initialButtonType = 'textButton';
}

const buttonType = expanded ? 'closeButton' : initialButtonType;

Expand Down
4 changes: 2 additions & 2 deletions src/components/post/post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,11 @@ const Post = ({ index, post = {} }: PostProps) => {
</span>
)}
</p>
{!isInPostView && commentMediaInfo?.type !== 'webpage' && (
{!isInPostView && (!(commentMediaInfo?.type === 'webpage') || (commentMediaInfo?.type === 'webpage' && content?.trim().length > 0)) && (
<ExpandButton
commentMediaInfo={commentMediaInfo}
content={content}
expanded={commentMediaInfo?.type === 'webpage' ? false : isExpanded}
expanded={isExpanded}
hasThumbnail={hasThumbnail}
link={link}
toggleExpanded={toggleExpanded}
Expand Down

0 comments on commit 80fcc58

Please sign in to comment.