mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-22 20:31:13 +00:00
wip
This commit is contained in:
parent
ad6db69dda
commit
bd69d941f1
1 changed files with 47 additions and 35 deletions
|
@ -325,10 +325,11 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
thumbnail() {
|
thumbnail() {
|
||||||
const post = this.postView.post;
|
const { post } = this.postView;
|
||||||
const url = post.url;
|
const { url } = post;
|
||||||
const thumbnail = post.thumbnail_url;
|
const thumbnail = post.thumbnail_url;
|
||||||
|
|
||||||
|
// if direct image link
|
||||||
if (!this.props.hideImage && url && isImage(url) && this.imageSrc) {
|
if (!this.props.hideImage && url && isImage(url) && this.imageSrc) {
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
|
@ -345,7 +346,10 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
} else if (!this.props.hideImage && url && thumbnail && this.imageSrc) {
|
}
|
||||||
|
|
||||||
|
// if link to url with included metadata image
|
||||||
|
if (!this.props.hideImage && url && thumbnail && this.imageSrc) {
|
||||||
return (
|
return (
|
||||||
<a
|
<a
|
||||||
className="thumbnail rounded overflow-hidden d-inline-block position-relative p-0 border-0"
|
className="thumbnail rounded overflow-hidden d-inline-block position-relative p-0 border-0"
|
||||||
|
@ -360,45 +364,53 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
} else if (url) {
|
}
|
||||||
if ((!this.props.hideImage && isVideo(url)) || post.embed_video_url) {
|
|
||||||
return (
|
// if link to direct/embedded video
|
||||||
<a
|
if (
|
||||||
className="text-body"
|
url &&
|
||||||
href={url}
|
((!this.props.hideImage && isVideo(url)) || post.embed_video_url)
|
||||||
title={url}
|
) {
|
||||||
rel={relTags}
|
|
||||||
data-tippy-content={I18NextService.i18n.t("expand_here")}
|
|
||||||
onClick={linkEvent(this, this.handleImageExpandClick)}
|
|
||||||
aria-label={I18NextService.i18n.t("expand_here")}
|
|
||||||
>
|
|
||||||
<div className="thumbnail rounded bg-light d-flex justify-content-center">
|
|
||||||
<Icon icon="play" classes="d-flex align-items-center" />
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return (
|
|
||||||
<a className="text-body" href={url} title={url} rel={relTags}>
|
|
||||||
<div className="thumbnail rounded bg-light d-flex justify-content-center">
|
|
||||||
<Icon icon="external-link" classes="d-flex align-items-center" />
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return (
|
return (
|
||||||
<Link
|
<a
|
||||||
className="text-body"
|
className="text-body"
|
||||||
to={`/post/${post.id}`}
|
href={url}
|
||||||
title={I18NextService.i18n.t("comments")}
|
title={url}
|
||||||
|
rel={relTags}
|
||||||
|
data-tippy-content={I18NextService.i18n.t("expand_here")}
|
||||||
|
onClick={linkEvent(this, this.handleImageExpandClick)}
|
||||||
|
aria-label={I18NextService.i18n.t("expand_here")}
|
||||||
>
|
>
|
||||||
<div className="thumbnail rounded bg-light d-flex justify-content-center">
|
<div className="thumbnail rounded bg-light d-flex justify-content-center">
|
||||||
<Icon icon="message-square" classes="d-flex align-items-center" />
|
<Icon icon="play" classes="d-flex align-items-center" />
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</a>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if link to url without metadata image
|
||||||
|
if (url) {
|
||||||
|
return (
|
||||||
|
<a className="text-body" href={url} title={url} rel={relTags}>
|
||||||
|
<div className="thumbnail rounded bg-light d-flex justify-content-center">
|
||||||
|
<Icon icon="external-link" classes="d-flex align-items-center" />
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if text-only post
|
||||||
|
return (
|
||||||
|
<Link
|
||||||
|
className="text-body"
|
||||||
|
to={`/post/${post.id}`}
|
||||||
|
title={I18NextService.i18n.t("comments")}
|
||||||
|
>
|
||||||
|
<div className="thumbnail rounded bg-light d-flex justify-content-center">
|
||||||
|
<Icon icon="message-square" classes="d-flex align-items-center" />
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
createdLine() {
|
createdLine() {
|
||||||
|
|
Loading…
Reference in a new issue