diff --git a/libs/embeds/src/link.ts b/libs/embeds/src/link.ts index 943fd6c..dab17de 100644 --- a/libs/embeds/src/link.ts +++ b/libs/embeds/src/link.ts @@ -63,18 +63,22 @@ export class LinkEmbed extends HTMLElement { } this.append(_link) + const _iconWrapper = ownerDocument.createElement('div') + _iconWrapper.classList.add('icon-wrapper') + _link.append(_iconWrapper) + const _icon = ownerDocument.createElement('img') - _link.append(_icon) _icon.alt = '' // decorative _icon.classList.add('no-inflate') + _iconWrapper.append(_icon) this._observers.icon = { element: _icon, observer: (oldVal, newVal) => { - const { element } = this._observers.icon if (!!newVal) { - element!.setAttribute('src', newVal) + _icon.setAttribute('src', newVal) + _iconWrapper.style.display = 'inherit' } else { - element!.style.display = 'hidden' + _iconWrapper.style.display = 'hidden' } }, }