From f46b82a34a200a9696d02a817eee1257ba2cfe6d Mon Sep 17 00:00:00 2001 From: Konrad Mohrfeldt <km@roko.li> Date: Thu, 30 May 2024 11:51:55 +0200 Subject: [PATCH] feat: allow ANavLink to be active if one of their children is active --- src/components/nav/ANavLink.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/nav/ANavLink.vue b/src/components/nav/ANavLink.vue index 3a09b071..787884ac 100644 --- a/src/components/nav/ANavLink.vue +++ b/src/components/nav/ANavLink.vue @@ -1,7 +1,7 @@ <template> <RouterLink v-if="route" - active-class="has-active-child" + :active-class="`${activeIfChildActive ? 'is-active' : ''} has-active-child`" exact-active-class="is-active" :class="linkClasses" :to="route" @@ -20,7 +20,7 @@ import { computed } from 'vue' const linkClasses = 'a-nav-link tw-no-underline tw-block tw-py-3 tw-px-6' -const props = defineProps<{ route?: Route; testId?: string }>() +const props = defineProps<{ route?: Route; testId?: string; activeIfChildActive?: boolean }>() const attrs = computed(() => ({ 'data-testid': props.testId })) </script> -- GitLab