diff options
author | crupest <crupest@outlook.com> | 2020-06-10 00:43:33 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-10 00:43:33 +0800 |
commit | 129eb19c02c1486db22efb3bf74344cd57129753 (patch) | |
tree | 1e9ae3c794a3f5d147152f26d2df362241c47bfc /Timeline/ClientApp/src/timeline/TimelineItem.tsx | |
parent | 4d2bec0331d551d8d47c929720fcb559253c24fd (diff) | |
parent | 5f9f27fd7001df347ab65e0cba849e583db31dc8 (diff) | |
download | timeline-129eb19c02c1486db22efb3bf74344cd57129753.tar.gz timeline-129eb19c02c1486db22efb3bf74344cd57129753.tar.bz2 timeline-129eb19c02c1486db22efb3bf74344cd57129753.zip |
Merge pull request #91 from crupest/scroll
Fix #90 .
Diffstat (limited to 'Timeline/ClientApp/src/timeline/TimelineItem.tsx')
-rw-r--r-- | Timeline/ClientApp/src/timeline/TimelineItem.tsx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Timeline/ClientApp/src/timeline/TimelineItem.tsx b/Timeline/ClientApp/src/timeline/TimelineItem.tsx index 7d488826..215c7b12 100644 --- a/Timeline/ClientApp/src/timeline/TimelineItem.tsx +++ b/Timeline/ClientApp/src/timeline/TimelineItem.tsx @@ -55,6 +55,7 @@ export interface TimelineItemProps { };
onClick?: () => void;
avatarVersion?: number;
+ onResize?: () => void;
}
const TimelineItem: React.FC<TimelineItemProps> = (props) => {
@@ -62,7 +63,7 @@ const TimelineItem: React.FC<TimelineItemProps> = (props) => { const current = props.current === true;
- const { more } = props;
+ const { more, onResize } = props;
const avatarUrl = useAvatarUrlWithGivenVersion(
props.avatarVersion,
@@ -117,7 +118,7 @@ const TimelineItem: React.FC<TimelineItemProps> = (props) => { className="float-right float-sm-left mx-2"
to={'/users/' + props.post.author.username}
>
- <img src={avatarUrl} className="avatar rounded" />
+ <img onLoad={onResize} src={avatarUrl} className="avatar rounded" />
</Link>
{(() => {
const { content } = props.post;
@@ -125,7 +126,11 @@ const TimelineItem: React.FC<TimelineItemProps> = (props) => { return content.text;
} else {
return (
- <img src={content.url} className="timeline-content-image" />
+ <img
+ onLoad={onResize}
+ src={content.url}
+ className="timeline-content-image"
+ />
);
}
})()}
|