Hide cookie details toggle for categories with no cookies
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -55,8 +55,6 @@ export class ProboCategoryList extends ProboElement {
|
|||||||
if (!this.template) return;
|
if (!this.template) return;
|
||||||
|
|
||||||
for (const cat of categories) {
|
for (const cat of categories) {
|
||||||
if (cat.cookies.length === 0) continue;
|
|
||||||
|
|
||||||
const wrapper = document.createElement("probo-category");
|
const wrapper = document.createElement("probo-category");
|
||||||
wrapper.setAttribute("name", cat.name);
|
wrapper.setAttribute("name", cat.name);
|
||||||
wrapper.setAttribute("slug", cat.slug);
|
wrapper.setAttribute("slug", cat.slug);
|
||||||
@@ -70,6 +68,12 @@ export class ProboCategoryList extends ProboElement {
|
|||||||
description: cat.description,
|
description: cat.description,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const hasCookies = cat.cookies && cat.cookies.length > 0;
|
||||||
|
if (!hasCookies) {
|
||||||
|
clone.querySelector("[data-action=toggle-cookies]")?.remove();
|
||||||
|
clone.querySelector("probo-cookie-list")?.remove();
|
||||||
|
}
|
||||||
|
|
||||||
wrapper.appendChild(clone);
|
wrapper.appendChild(clone);
|
||||||
this.appendChild(wrapper);
|
this.appendChild(wrapper);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user