From 3504c94cb37fd55e6dfb0596319bb40593202822 Mon Sep 17 00:00:00 2001
From: Anita Lipsky <7695311+purplebugs@users.noreply.github.com>
Date: Tue, 5 Nov 2024 21:34:38 +0100
Subject: [PATCH] feat: Attribute linkToFarmPage shows link to alpaca.life farm
page (#48)
---
README.md | 11 +++++++++++
src/alpaca-map-icon.js | 9 +++++++++
src/alpaca-map-marker.js | 33 ++++++++++++++++++++++++++++-----
src/alpaca-map.js | 5 +++++
src/styles-map-marker.js | 5 +++--
5 files changed, 56 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index a2d7f52..512aca3 100644
--- a/README.md
+++ b/README.md
@@ -35,6 +35,17 @@ Web component created using [lit](https://lit.dev/)
```
+1. Optional. To override map markers linking to the farm page, set the value of `linkToFarmPage`
+
+- `true`- shows link on map marker to www.alpaca.life farm info page
+- `false`- does not show link
+
+eg
+
+```
+
+```
+
## For developers 🤖
### Install app 🪴
diff --git a/src/alpaca-map-icon.js b/src/alpaca-map-icon.js
index e8d4fd7..b63dfb7 100644
--- a/src/alpaca-map-icon.js
+++ b/src/alpaca-map-icon.js
@@ -63,6 +63,12 @@ export default class AlpacaMapIcon extends LitElement {
return html`${path} `;
}
+ _iconCircleInfo() {
+ const path = svg` `;
+
+ return html`${path} `;
+ }
+
_iconHandshake() {
const path = svg` `;
@@ -120,6 +126,9 @@ export default class AlpacaMapIcon extends LitElement {
case "calendarCheck":
icon = this._iconCalendarCheck();
break;
+ case "circleInfo":
+ icon = this._iconCircleInfo();
+ break;
case "handShake":
icon = this._iconHandshake();
break;
diff --git a/src/alpaca-map-marker.js b/src/alpaca-map-marker.js
index bb05d6e..f89e2a0 100644
--- a/src/alpaca-map-marker.js
+++ b/src/alpaca-map-marker.js
@@ -1,8 +1,9 @@
-import { LitElement, html, css } from "lit";
+import { LitElement, nothing, html, css } from "lit";
import "./alpaca-map-icon.js";
export default class AlpacaMapMarker extends LitElement {
static properties = {
+ id: { type: Number },
name: { type: String },
category: { type: String },
count: { type: Number },
@@ -19,6 +20,7 @@ export default class AlpacaMapMarker extends LitElement {
}
},
} /* If a property changes the element re-renders */,
+ linkToFarmPage: { type: Boolean },
};
constructor() {
@@ -39,6 +41,27 @@ export default class AlpacaMapMarker extends LitElement {
super.connectedCallback();
}
+ renderLinkToFarmPage() {
+ if (this.linkToFarmPage) {
+ return html`
+
+
+
+ `;
+ }
+
+ return html`${nothing}`;
+ }
+
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.
@@ -55,32 +78,32 @@ export default class AlpacaMapMarker extends LitElement {
${this.count} 🦙
-