Update components.js

This commit is contained in:
Artemy 2024-01-24 15:31:45 +03:00
parent f3f59e0ce0
commit 61d60682a6

View file

@ -7,14 +7,14 @@ export function countryPopup(country, properties) {
return `<div class="row" style="padding: 5px;">
${img(country.img)}
${title(country.name)}
${tags(properties.tags)}
<div class="col-12 glass p-2">
${JSON.parse(properties.tags || "[]").join(", ")}
${l("founded")}: ${new Date(country.date).toLocaleDateString()}
${l("founded")}: ${new Date(country.date).toLocaleDateString()}<br/>
${
country.description
? `<div>${converter.makeHtml(country.description)}</div>`
: ""
}
}<br/>
${l("area")}: ${properties.area} ${l("km")}²
</div>
<div class="col-12 text-center mt-2">
@ -27,6 +27,14 @@ export function countryPopup(country, properties) {
</div>`;
}
function tags(tags) {
let tagstxt = JSON.parse(tags || "[]").join(", ");
return tagstxt
? `<div class="col-12 glass p-2 text-center mb-2"> ${tagstxt}</div>`
: "";
}
function img(url) {
return `<div class="col-12 col-sm-12" style="padding: 0px;"><img class="w-100 about-img" src="${url}"></div>`;
}