Skip to content

Commit 57f145f

Browse files
authored
Fix: Active indicator in app header layout (#48)
1 parent 7f4662e commit 57f145f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

resources/js/components/AppHeader.vue

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ const props = withDefaults(defineProps<Props>(), {
3232
const page = usePage();
3333
const auth = computed(() => page.props.auth);
3434
35-
const isCurrentRoute = (url: string) => {
36-
return page.url === url;
37-
};
35+
const isCurrentRoute = computed(() => (url: string) => page.url === url);
3836
39-
const activeItemStyles = computed(() => (url: string) => (isCurrentRoute(url) ? 'text-neutral-900 dark:bg-neutral-800 dark:text-neutral-100' : ''));
37+
const activeItemStyles = computed(
38+
() => (url: string) => (isCurrentRoute.value(url) ? 'text-neutral-900 dark:bg-neutral-800 dark:text-neutral-100' : ''),
39+
);
4040
4141
const mainNavItems: NavItem[] = [
4242
{
@@ -125,7 +125,10 @@ const rightNavItems: NavItem[] = [
125125
{{ item.title }}
126126
</NavigationMenuLink>
127127
</Link>
128-
<div class="absolute bottom-0 left-0 h-0.5 w-full translate-y-px bg-black dark:bg-white"></div>
128+
<div
129+
v-if="isCurrentRoute(item.href)"
130+
class="absolute bottom-0 left-0 h-0.5 w-full translate-y-px bg-black dark:bg-white"
131+
></div>
129132
</NavigationMenuItem>
130133
</NavigationMenuList>
131134
</NavigationMenu>

0 commit comments

Comments
 (0)