problem: menu highlight doesn't work properly

This commit is contained in:
Bob
2024-07-18 17:27:49 +08:00
parent 0d601fdd02
commit 842a782bf0

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';