Skip to content

Commit

Permalink
refactor(nav): update NavLink icon and handle active link logic
Browse files Browse the repository at this point in the history
  • Loading branch information
yacosta738 committed Oct 8, 2024
1 parent ec2f2bb commit af00ca6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions apps/frontend/apps/lyra-app/components/nav/NavLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const props = withDefaults(
isCollapsed?: boolean;
}>(),
{
icon: 'lucide:file',
icon: 'ph:dot-thin',
title: '',
to: '',
label: '',
Expand All @@ -39,7 +39,9 @@ const { hasPermission } = usePermissionCheck(props.to);
const isActiveLink = computed(() => {
if (!props.to) return false;
return route.path === props.to || route.path.startsWith(props.to);
if (route.path === props.to) return true;
if (props.to === '/') return route.path === '/';
return route.path.startsWith(props.to);
});
const computedClasses = computed(() => {
Expand Down
6 changes: 3 additions & 3 deletions apps/frontend/apps/lyra-app/components/nav/links-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ const navigationLinks: LinkProp[] = [
title: 'Dashboard',
to: '/',
icon: 'lucide:layout-dashboard',
variant: 'default',
variant: 'ghost',
},
{
id: generateId('Start Writing'),
title: 'Start Writing',
to: '/',
to: '/posts',
icon: 'lucide:layout-dashboard',
variant: 'default',
variant: 'ghost',
},
{
id: generateId('Posts'),
Expand Down

0 comments on commit af00ca6

Please sign in to comment.