From aa95f24a0fd8b1c67355aabd319a23d2e5e5bb3e Mon Sep 17 00:00:00 2001 From: Anita Lipsky Date: Wed, 6 Nov 2024 10:41:23 +0100 Subject: [PATCH] style: Webpage box link in marker --- src/alpaca-map-marker.js | 37 ++++++++++++++++++++++++++++++++++++- src/alpaca-map.js | 4 ++++ src/styles-map-marker.js | 1 + 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/alpaca-map-marker.js b/src/alpaca-map-marker.js index f89e2a0..7d6d8fe 100644 --- a/src/alpaca-map-marker.js +++ b/src/alpaca-map-marker.js @@ -9,6 +9,8 @@ export default class AlpacaMapMarker extends LitElement { count: { type: Number }, city: { type: String }, address: { type: String }, + url_full: { type: String }, + url_pretty: { type: String }, directions: { type: String }, highlight: { type: String, @@ -30,6 +32,8 @@ export default class AlpacaMapMarker extends LitElement { this.count; this.city; this.address; + this.url_full; + this.url_pretty; this.directions; this.highlight = false; } @@ -62,6 +66,37 @@ export default class AlpacaMapMarker extends LitElement { return html`${nothing}`; } + renderLinkToWebPage() { + if (this.url_full === null || this.url_full === undefined) { + return html`${nothing}`; + } + + if (this.url_pretty === null || this.url_pretty === undefined) { + return html`${nothing}`; + } + + return html` + + + + `; + } + createRenderRoot() { // Turns off shadow DOM. // Since AlpacaMapMarker is not used externally, only by AlpacaMap then we want to inherit all styling, so turn off shadow DOM. @@ -91,7 +126,7 @@ export default class AlpacaMapMarker extends LitElement {
${this.address}
- ${this.renderLinkToFarmPage()} + ${this.renderLinkToFarmPage()} ${this.renderLinkToWebPage()}