Created
July 26, 2023 18:39
-
-
Save LosantGists/3619d515ebe64954a86dd9b2fa0ef55b to your computer and use it in GitHub Desktop.
map icon window HTML
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const iconWindowHTML = (data, iconsData) => { | |
const iconWindowElement = document.createElement('div'); | |
iconWindowElement.classList.add('card', 'marker-window'); | |
const iconsHTML = Object.values(iconsData).map(iconData => { | |
if(!iconData?.icon){ | |
return ''; | |
} | |
return ` | |
<div class="d-flex flex-column align-items-center mr-1"> | |
${iconData.icon.outerHTML} | |
<div class="m-1"> | |
${iconData.value}${iconData.unit} | |
</div> | |
<div> | |
${iconData.attribute} | |
</div> | |
</div>`; | |
}).join(''); | |
iconWindowElement.innerHTML = ` | |
<div class="card-body"> | |
<h6 class="card-title">${data.name}</h6> | |
<div class="icons-list"> | |
${iconsHTML} | |
</div> | |
</div> | |
`; | |
return iconWindowElement; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment