Skip to content

Commit

Permalink
MWPW-160061: Clickable App and Playstore links (#3021)
Browse files Browse the repository at this point in the history
* Clickable app and playstore links

* use the correct order

* Add safeguards
  • Loading branch information
mokimo authored Oct 22, 2024
1 parent 63ff041 commit 47f1c0d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions libs/blocks/media/media.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ function decorateAvatar(el) {
function decorateQr(el) {
const text = el.querySelector('.text');
if (!text) return;
const appStore = text.children[(text.children.length - 1)];
const googlePlay = text.children[(text.children.length - 2)];
const appStore = text.children[(text.children.length - 1)]?.querySelector('a');
const googlePlay = text.children[(text.children.length - 2)]?.querySelector('a');
const qrImage = text.children[(text.children.length - 3)];
if (!qrImage || !appStore || !googlePlay) return;
qrImage.classList.add('qr-code-img');
appStore.classList.add('app-store');
appStore.textContent = '';
googlePlay.classList.add('google-play');
googlePlay.textContent = '';
qrImage.classList.add('qr-code-img');
}

export default async function init(el) {
Expand Down

0 comments on commit 47f1c0d

Please sign in to comment.