Skip to content

Commit a26bf28

Browse files
authored
Feat: Add visual highlighting to the currently active navigation link (#131)
* chore: upgrade deps * refactor: remove unnecessary copy * Add visual highlighting to the currently active navigation link * fix: failed CI * fix: ci
1 parent 92255af commit a26bf28

File tree

8 files changed

+94
-78
lines changed

8 files changed

+94
-78
lines changed

.github/workflows/e2e.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,6 @@ jobs:
2929
- name: Build app
3030
run: bun run build
3131

32-
- name: Start server
33-
run: npx serve@latest out -l 3001 &
34-
shell: bash
35-
36-
- name: Wait for server to be ready
37-
run: npx wait-on http://localhost:3001 --timeout 60000
38-
3932
- name: Run E2E tests (headless)
4033
env:
4134
CI: true

.github/workflows/pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- uses: oven-sh/setup-bun@v2
3636

3737
- name: Install dependencies
38-
run: bun install
38+
run: bun install --frozen-lockfile
3939

4040
- name: Install Puppeteer and serve
4141
run: bun install puppeteer serve
@@ -47,7 +47,7 @@ jobs:
4747
id: screenshots
4848
run: |
4949
# Start the server in the background
50-
npx serve out -p 3000 &
50+
bun run start &
5151
# Wait longer for server to start
5252
sleep 10
5353
# Take screenshots

app/[lang]/(hyperjump)/components/nav.tsx

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -83,21 +83,34 @@ export default function Nav({ lang }: NavProps) {
8383
<CenterNavItems>
8484
<NavigationMenu className="mx-8 xl:mx-0">
8585
<NavigationMenuList className="flex items-center space-x-8">
86-
{menu(lang).map(({ href, label }) => (
87-
<NavigationMenuItem key={label} className="flex items-center">
88-
<Link
89-
href={href}
90-
onClick={() => setIsOpen(false)}
91-
className={cn(
92-
"text-xl font-medium transition duration-300",
93-
isTransparent
94-
? "group-data-[scroll=true]:text-hyperjump-black hover:group-data-[scroll=true]:text-hyperjump-blue group-data-[scroll=false]:text-white hover:group-data-[scroll=false]:border-b-2"
95-
: "text-hyperjump-black hover:text-hyperjump-blue"
96-
)}>
97-
{label}
98-
</Link>
99-
</NavigationMenuItem>
100-
))}
86+
{menu(lang).map(({ href, label }) => {
87+
const isActive = pathname.startsWith(href);
88+
89+
return (
90+
<NavigationMenuItem
91+
key={label}
92+
className="flex items-center">
93+
<Link
94+
href={href}
95+
onClick={() => setIsOpen(false)}
96+
className={cn(
97+
"text-xl font-medium transition duration-300",
98+
isTransparent &&
99+
isActive &&
100+
"group-data-[scroll=true]:text-hyperjump-blue group-data-[scroll=false]:border-b-2",
101+
isTransparent &&
102+
!isActive &&
103+
"group-data-[scroll=true]:text-hyperjump-black hover:group-data-[scroll=true]:text-hyperjump-blue group-data-[scroll=false]:text-white hover:group-data-[scroll=false]:border-b-2",
104+
!isTransparent && isActive && "text-hyperjump-blue",
105+
!isTransparent &&
106+
!isActive &&
107+
"text-hyperjump-black hover:text-hyperjump-blue"
108+
)}>
109+
{label}
110+
</Link>
111+
</NavigationMenuItem>
112+
);
113+
})}
101114
</NavigationMenuList>
102115
</NavigationMenu>
103116
</CenterNavItems>
@@ -143,15 +156,21 @@ export default function Nav({ lang }: NavProps) {
143156
{isOpen && (
144157
<div className="bg-white shadow-md lg:hidden">
145158
<div className="mx-auto flex w-full flex-col space-y-4 px-4 py-5 md:px-20 xl:px-0">
146-
{menu(lang).map(({ href, label }) => (
147-
<Link
148-
key={label}
149-
href={href}
150-
className="text-hyperjump-black text-2xl transition hover:text-gray-400"
151-
onClick={() => setIsOpen(false)}>
152-
{label}
153-
</Link>
154-
))}
159+
{menu(lang).map(({ href, label }) => {
160+
const isActive = pathname.startsWith(href);
161+
return (
162+
<Link
163+
key={label}
164+
href={href}
165+
className={cn(
166+
"text-2xl transition hover:text-gray-400",
167+
isActive ? "text-hyperjump-blue" : "text-hyperjump-black"
168+
)}
169+
onClick={() => setIsOpen(false)}>
170+
{label}
171+
</Link>
172+
);
173+
})}
155174
</div>
156175
</div>
157176
)}

bun.lock

Lines changed: 31 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

locales/en/products.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"3": {
1919
"title": "Voxa",
20-
"text": "Short description: Voxa helps you reach prospects over the phone with natural AI voices, smart lead targeting, and automated call flows."
20+
"text": "Voxa helps you reach prospects over the phone with natural AI voices, smart lead targeting, and automated call flows."
2121
}
2222
}
2323
},

locales/id/products.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"3": {
1919
"title": "Voxa",
20-
"text": "Deskripsi singkat: Voxa membantu Anda menjangkau prospek melalui panggilan telepon dengan suara AI yang natural, penargetan prospek cerdas, dan alur panggilan otomatis."
20+
"text": "Voxa membantu Anda menjangkau prospek melalui panggilan telepon dengan suara AI yang natural, penargetan prospek cerdas, dan alur panggilan otomatis."
2121
}
2222
}
2323
},

0 commit comments

Comments
 (0)