import { Component, linkEvent } from 'inferno'; import { Post } from 'lemmy-js-client'; import { mdToHtml } from '../utils'; import { i18n } from '../i18next'; interface FramelyCardProps { post: Post; } interface FramelyCardState { expanded: boolean; } export class IFramelyCard extends Component< FramelyCardProps, FramelyCardState > { private emptyState: FramelyCardState = { expanded: false, }; constructor(props: any, context: any) { super(props, context); this.state = this.emptyState; } render() { let post = this.props.post; return ( <> {post.embed_title && !this.state.expanded && (
{post.embed_html ? ( {post.embed_title} ) : ( {post.embed_title} )}
{new URL(post.url).hostname} {post.embed_html && ( {this.state.expanded ? '[-]' : '[+]'} )} {post.embed_description && (
)}
)} {this.state.expanded && (
)} ); } handleIframeExpand(i: IFramelyCard) { i.state.expanded = !i.state.expanded; i.setState(i.state); } }