Skip to content
Snippets Groups Projects
Commit 3412bd0b authored by Jean-Baptiste Pasquier's avatar Jean-Baptiste Pasquier
Browse files

fix: 14

parent d067dd5e
No related branches found
No related tags found
No related merge requests found
Pipeline #19615 passed with stage
in 27 seconds
......@@ -11,6 +11,21 @@ customElements.define(
crumbs: { attribute: "crumbs", type: Array },
};
_navigate(crumb) {
const target = {
route: crumb.route,
};
if (crumb.resource) {
target.resource = crumb.resource;
}
window.dispatchEvent(
new CustomEvent("requestNavigation", {
detail: target,
}),
);
}
render() {
if (!this.crumbs || this.crumbs.length === 0) {
return nothing;
......@@ -20,14 +35,8 @@ customElements.define(
<ul class="tzcld-breadcrumb">
${this.crumbs.map((crumb) => {
return html`
<li>
<solid-link
next="${crumb.route}"
data-src="${crumb.resource || nothing}"
class="link-text"
>
<li class="link-text" @click=${() => this._navigate(crumb)}>
${crumb.text}
</solid-link>
</li>
`;
})}
......
......@@ -22,18 +22,30 @@ customElements.define(
const resource = await sibStore.getData(dataSrc, CLIENT_CONTEXT);
const community = await getProxyValue(resource, [
{ key: "@type", value: "@type" },
{ key: "name", value: "name" },
]);
console.log(community["@type"]);
return [
{ route: route, text: this.parent?.pageTitle || "Mes territoires" },
{
route: `${route}-my-territory-infos`,
const newCrumbs = [];
if (community["@type"].endsWith("Community")) {
newCrumbs.push({
route: route,
text: this.parent?.pageTitle || "Mes territoires",
});
newCrumbs.push({
route: `${route}-infos`,
resource: dataSrc,
text: community.name,
},
...(crumbs ?? []),
];
});
} else {
newCrumbs.push({
route: `${route}-infos`,
text: "...",
});
}
newCrumbs.push(...(crumbs ?? []));
return newCrumbs;
},
args: () => [this.dataSrc, this.crumbs, this.route],
});
......
......@@ -7,26 +7,26 @@
font-weight: 500;
line-height: normal;
color: var(--color-secondary);
user-select: none;
li {
display: inline;
}
li::after {
content: ">";
margin: 0 5px;
}
li:last-child::after {
content: "";
}
solid-link {
display: inline-block;
font-size: inherit;
font-style: inherit;
font-weight: inherit;
line-height: inherit;
text-decoration-line: underline;
text-decoration: underline;
color: inherit;
cursor: pointer;
&::after {
display: inline-block;
cursor: default;
text-decoration: none;
content: ">";
margin: 0 5px;
}
&:last-child::after {
content: "";
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment