Skip to content
Snippets Groups Projects
Commit 06646f95 authored by Neuber, Eugen Ramon's avatar Neuber, Eugen Ramon :speech_balloon:
Browse files

Add "part" to side menu item in AppShell

parent ff85da1f
No related branches found
No related tags found
No related merge requests found
...@@ -344,6 +344,10 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) { ...@@ -344,6 +344,10 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) {
// if not the current page was clicked we need to check if the page can be left // if not the current page was clicked we need to check if the page can be left
if (!e.currentTarget.className.includes("selected")) { if (!e.currentTarget.className.includes("selected")) {
this.shadowRoot.querySelectorAll('li > a').forEach(
(a) => a.setAttribute("part", "side-menu-item")
);
e.currentTarget.setAttribute("part", "side-menu-item-selected");
// simulate a "beforeunload" event // simulate a "beforeunload" event
const event = new CustomEvent("beforeunload", { const event = new CustomEvent("beforeunload", {
bubbles: true, bubbles: true,
...@@ -864,7 +868,7 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) { ...@@ -864,7 +868,7 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) {
// build the menu // build the menu
let menuTemplates = []; let menuTemplates = [];
for (let routingName of this.visibleRoutes) { for (let routingName of this.visibleRoutes) {
menuTemplates.push(html`<li><a @click="${(e) => this.onMenuItemClick(e)}" href="${this.router.getPathname({component: routingName})}" data-nav class="${getSelectClasses(routingName)}" title="${this.metaDataText(routingName, "description")}">${this.metaDataText(routingName, "short_name")}</a></li>`); menuTemplates.push(html`<li><a @click="${(e) => this.onMenuItemClick(e)}" href="${this.router.getPathname({component: routingName})}" data-nav class="${getSelectClasses(routingName)}" title="${this.metaDataText(routingName, "description")}" part="side-menu-item${this.activeView === routingName ? '-selected' : ''}">${this.metaDataText(routingName, "short_name")}</a></li>`);
} }
const imprintUrl = this.lang === "en" ? const imprintUrl = this.lang === "en" ?
...@@ -908,7 +912,7 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) { ...@@ -908,7 +912,7 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) {
</h2> </h2>
<ul class="menu hidden"> <ul class="menu hidden">
${menuTemplates} ${menuTemplates}
<li class="close" @click="${this.hideMenu}"><dbp-icon name="close" style="color: red"></dbp-icon></li> <li class="close" @click="${this.hideMenu}" part="side-menu-item"><dbp-icon name="close" style="color: red"></dbp-icon></li>
</ul> </ul>
</aside> </aside>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment