Merge pull request #26 from bob2402/menu-highlight

problem: menu highlight doesn't work properly
This commit is contained in:
gsovereignty
2024-07-19 15:33:32 +08:00
committed by GitHub

View File

@@ -7,9 +7,8 @@
let iconClass = 'h-5 w-5 md:h-4 md:w-4';
let getClass = (menuItem: string) => {
//todo: make this re-run any time our path changes
if ($page.url.pathname.includes(menuItem)) {
$: getClass = (menuItem: string) => {
if ($page.url.pathname.startsWith(`/${menuItem}`)) {
return 'flex items-center gap-3 rounded-lg bg-muted px-3 py-2 text-primary transition-all hover:text-primary';
} else {
return 'flex items-center gap-3 rounded-lg px-3 py-2 text-muted-foreground transition-all hover:text-primary';