Skip to content

Commit

Permalink
feat: Prevent click on loading image (#18309)
Browse files Browse the repository at this point in the history
  • Loading branch information
przemvs authored Nov 14, 2024
1 parent e1e6ce8 commit 6bd35b3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/script/components/Image/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,12 @@ export const Image = ({
<InViewport
onVisible={() => setIsInViewport(true)}
css={getWrapperStyles(!!onClick)}
className={cx(className, {'loading-dots': isLoading})}
onClick={onClick}
className={cx(className, {'loading-dots image-asset--no-image': isLoading})}
onClick={event => {
if (!isLoading) {
onClick?.(event);
}
}}
data-uie-status={isLoading ? 'loading' : 'loaded'}
{...props}
>
Expand Down
6 changes: 4 additions & 2 deletions src/style/content/conversation/message-list.less
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,10 @@
cursor: pointer;

&--no-image {
background-color: var(--foreground-fade-8);
cursor: default;
.message-asset & {
background-color: var(--foreground-fade-8);
cursor: default;
}
}

.image-icon svg {
Expand Down

0 comments on commit 6bd35b3

Please sign in to comment.