1 import { Component } from "inferno";
2 import { Post } from "lemmy-js-client";
3 import * as sanitizeHtml from "sanitize-html";
4 import { relTags } from "../../config";
5 import { Icon } from "../common/icon";
7 interface MetadataCardProps {
11 export class MetadataCard extends Component<MetadataCardProps> {
12 constructor(props: any, context: any) {
13 super(props, context);
17 const post = this.props.post;
19 if (post.embed_title && post.url) {
21 <div className="post-metadata-card card border-secondary mt-3 mb-2">
23 <div className="col-12">
24 <div className="card-body">
25 {post.name !== post.embed_title && (
27 <h5 className="card-title d-inline">
28 <a className="text-body" href={post.url} rel={relTags}>
32 <span className="d-inline-block ms-2 mb-2 small text-muted">
34 className="text-muted fst-italic"
38 {new URL(post.url).hostname}
39 <Icon icon="external-link" classes="ms-1" />
44 {post.embed_description && (
46 className="card-text small text-muted md-div"
47 dangerouslySetInnerHTML={{
48 __html: sanitizeHtml(post.embed_description),