Skip to content

Commit d1f482f

Browse files
Update Layout.tsx
1 parent 5e34158 commit d1f482f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

components/Layout.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ const MainNavLink = ({
137137
className?: string;
138138
}) => {
139139
const router = useRouter();
140+
const isActiveNav = extractPathWithoutFragment(router.asPath) === uri;
141+
140142
return (
141143
<Link
142144
href={uri}
@@ -148,7 +150,13 @@ const MainNavLink = ({
148150
// ? 'text-primary hover:text-primary'
149151
// : 'text-slate-600 hover:text-primary'
150152
// }`,
151-
`${extractPathWithoutFragment(router.asPath) === uri ? 'text-primary dark:text-white dark:underline hover:text-primary' : 'text-slate-600 dark:text-white hover:text-primary dark:hover:underline'}`,
153+
// `${extractPathWithoutFragment(router.asPath) === uri ? 'text-primary dark:text-white dark:underline hover:text-primary' : 'text-slate-600 dark:text-white hover:text-primary dark:hover:underline'}`,
154+
{
155+
'text-primary dark:text-white dark:underline hover:text-primary':
156+
isActiveNav,
157+
'text-slate-600 dark:text-white hover:text-primary dark:hover:underline':
158+
!isActiveNav,
159+
},
152160
)}
153161
>
154162
{label}

0 commit comments

Comments
 (0)