Verified Commit c2bc782d authored by Jakob Moser's avatar Jakob Moser
Browse files

Also treat empty route as /

parent c5fbc21e
Loading
Loading
Loading
Loading
Loading
+4 −2
Changes for js/components/pieces/NavPageLink.mjs: 4 added lines, 2 removed lines.
Original line number Diff line number Diff line
export const NavPageLink = {
    view(vnode) {
        const href = vnode.attrs.href
        const current = m.route.get() === href
        const currentRoute = m.route.get()
        const isCurrent =
            currentRoute === href || (currentRoute === "" && href === "/")

        return m(
            m.route.Link,
            { href, class: current ? "current" : "" },
            { href, class: isCurrent ? "current" : "" },
            vnode.attrs.label,
        )
    },