From 47e6007c02a1e3d3a39aa2094ba65e7a5dc97784 Mon Sep 17 00:00:00 2001 From: Guilherme Pimenta Date: Thu, 27 Jun 2024 18:14:06 -0300 Subject: [PATCH 1/5] Closes: https://topsort.atlassian.net/browse/API-920 From b7916418ff05f049ed73a1b7a1a7b21f1bfb387c Mon Sep 17 00:00:00 2001 From: Guilherme Pimenta Date: Fri, 28 Jun 2024 14:01:45 -0300 Subject: [PATCH 2/5] add option to open target in a new tab --- README.md | 21 +++++++++++---------- src/index.ts | 11 ++++++++--- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index fa4fd9e..6919872 100644 --- a/README.md +++ b/README.md @@ -48,16 +48,17 @@ Directly from unpkg.com # Banner Attributes -| Name | Type | Description | -| ---------------------- | --------------- | ------------------------------------------------------------------ | -| width | Number | Banner width | -| height | Number | Banner height | -| id | String | The slot ID for this banner | -| category-id* | Optional String | The category ID of the current page | -| category-ids* | Optional String | Comma (,) separated list of category IDs, the item must match all | -| category-disjunctions* | Optional String | Comma (,) separated list of category IDs, the item must match any | -| search-query | Optional String | The search query of the current page | -| location | Optional String | The location for geotargeting | +| Name | Type | Description | +| ---------------------- | --------------- | --------------------------------------------------------------------------- | +| width | Number | Banner width | +| height | Number | Banner height | +| id | String | The slot ID for this banner | +| category-id* | Optional String | The category ID of the current page | +| category-ids* | Optional String | Comma (,) separated list of category IDs, the item must match all | +| category-disjunctions* | Optional String | Comma (,) separated list of category IDs, the item must match any | +| search-query | Optional String | The search query of the current page | +| location | Optional String | The location for geotargeting | +| new-tab | Boolean | Opens the link in a new tab (defaults to false) | \* Only one of `[category-id, category-ids, category-disjunctions]` must be set. If multiple are set, only the first will be considered, in that order. diff --git a/src/index.ts b/src/index.ts index dcb580b..35e8e1b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -75,6 +75,9 @@ export class TopsortBanner extends LitElement { @property({ attribute: "location", type: String }) readonly location?: string; + @property({ attribute: "new-tab", type: Boolean }) + readonly newTab?: boolean; + private task = new Task(this, { task: (...args) => this.runAuction(...args), args: () => [], @@ -130,14 +133,16 @@ export class TopsortBanner extends LitElement { } `; const href = this.getLink(banner); + const imgtag = html`Topsort banner`; + const atag = this.newTab + ? html`${imgtag}` + : html`${imgtag}`; return html`
- - Topsort banner - + ${atag}
`; } From d2213fd5454b4c994417388633e06b098c7c7145 Mon Sep 17 00:00:00 2001 From: Guilherme Pimenta Date: Fri, 28 Jun 2024 14:19:56 -0300 Subject: [PATCH 3/5] set as optional on docs --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 6919872..78ed394 100644 --- a/README.md +++ b/README.md @@ -48,17 +48,17 @@ Directly from unpkg.com # Banner Attributes -| Name | Type | Description | -| ---------------------- | --------------- | --------------------------------------------------------------------------- | -| width | Number | Banner width | -| height | Number | Banner height | -| id | String | The slot ID for this banner | -| category-id* | Optional String | The category ID of the current page | -| category-ids* | Optional String | Comma (,) separated list of category IDs, the item must match all | -| category-disjunctions* | Optional String | Comma (,) separated list of category IDs, the item must match any | -| search-query | Optional String | The search query of the current page | -| location | Optional String | The location for geotargeting | -| new-tab | Boolean | Opens the link in a new tab (defaults to false) | +| Name | Type | Description | +| ---------------------- | ---------------- | --------------------------------------------------------------------------- | +| width | Number | Banner width | +| height | Number | Banner height | +| id | String | The slot ID for this banner | +| category-id* | Optional String | The category ID of the current page | +| category-ids* | Optional String | Comma (,) separated list of category IDs, the item must match all | +| category-disjunctions* | Optional String | Comma (,) separated list of category IDs, the item must match any | +| search-query | Optional String | The search query of the current page | +| location | Optional String | The location for geotargeting | +| new-tab | Optional Boolean | Opens the link in a new tab (defaults to false) | \* Only one of `[category-id, category-ids, category-disjunctions]` must be set. If multiple are set, only the first will be considered, in that order. From 6da51ba0b41a4409274b280bc2caffd6413951ec Mon Sep 17 00:00:00 2001 From: Guilherme Pimenta Date: Mon, 1 Jul 2024 10:54:19 -0300 Subject: [PATCH 4/5] chore: lint --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 35e8e1b..3cf5b16 100644 --- a/src/index.ts +++ b/src/index.ts @@ -133,7 +133,7 @@ export class TopsortBanner extends LitElement { } `; const href = this.getLink(banner); - const imgtag = html`Topsort banner`; + const imgtag = html`Topsort banner`; const atag = this.newTab ? html`${imgtag}` : html`${imgtag}`; From f972c2eb38c31f8732f6e918812059544e270703 Mon Sep 17 00:00:00 2001 From: Guilherme Pimenta Date: Mon, 1 Jul 2024 14:44:54 -0300 Subject: [PATCH 5/5] Update README.md Co-authored-by: Pablo Reszczynski --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 78ed394..436dab8 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Directly from unpkg.com | category-disjunctions* | Optional String | Comma (,) separated list of category IDs, the item must match any | | search-query | Optional String | The search query of the current page | | location | Optional String | The location for geotargeting | -| new-tab | Optional Boolean | Opens the link in a new tab (defaults to false) | +| new-tab | Optional Boolean | Opens the banner's link in a new tab (defaults to false) | \* Only one of `[category-id, category-ids, category-disjunctions]` must be set. If multiple are set, only the first will be considered, in that order.