Skip to content

Commit

Permalink
Update components.js
Browse files Browse the repository at this point in the history
  • Loading branch information
artegoser committed Jan 24, 2024
1 parent f3f59e0 commit 61d6068
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand All @@ -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>`;
}
Expand Down

0 comments on commit 61d6068

Please sign in to comment.