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 interface MetadataCardState {
15 export class MetadataCard extends Component<
19 constructor(props: any, context: any) {
20 super(props, context);
24 const post = this.props.post;
27 {post.embed_title && post.url && (
28 <div className="post-metadata-card card border-secondary mt-3 mb-2">
30 <div className="col-12">
31 <div className="card-body">
32 {post.name !== post.embed_title && (
34 <h5 className="card-title d-inline">
35 <a className="text-body" href={post.url} rel={relTags}>
39 <span className="d-inline-block ms-2 mb-2 small text-muted">
41 className="text-muted fst-italic"
45 {new URL(post.url).hostname}
46 <Icon icon="external-link" classes="ms-1" />
51 {post.embed_description && (
53 className="card-text small text-muted md-div"
54 dangerouslySetInnerHTML={{
55 __html: sanitizeHtml(post.embed_description),