import {html} from 'lit'; import {customElement} from 'lit/decorators.js'; import {styles} from './link.styles'; import {LinkPreviewDataDirective} from './directives/link-preview-data-directive'; import {TEST_IDS} from './lib/util/test-helper'; import './components/skeleton-shape'; import './components/limit-info'; import './components/powered-by-previewbox'; import './components/favicon'; import './components/image'; import {ApiError} from './lib/services/api-fetcher'; /** * Previewbox Link | * * @csspart link - The a-element that contains the link * @csspart container - The container element that contains the anchor element */ @customElement('previewbox-link') export class PreviewBoxLinkElement extends LinkPreviewDataDirective { static override styles = styles; override render() { return html`
${this._apiError === ApiError.API_LIMIT_REACHED ? html`` : ''}
${this._isLoading ? html`` : this.linkData.title}
${this._isLoading ? html` ` : this.linkData.description}
${typeof this.hidePoweredBy !== 'undefined' ? '' : html``}
`; } } declare global { interface HTMLElementTagNameMap { 'previewbox-link': PreviewBoxLinkElement; } }