Skip to content

Commit d1720fa

Browse files
committed
Implemented a loop for the items in navbar and upgraded the highlight style
1 parent 4880a3c commit d1720fa

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

src/routes/(app)/_components/layout/navbar.svelte

+11-13
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
import { page } from '$app/stores';
33
44
$: currentPage = $page.url.pathname;
5+
const links = [{href: "/team/", label: "Equipa", pageComp: "/team"},
6+
{href: "/projects/", label: "Projects", pageComp: "/projects"},
7+
{href: "/events/", label: "Eventos", pageComp: "/events"},
8+
{href: "/contacts/", label: "Contactos", pageComp: "/contacts"}];
59
</script>
610

711
<nav
@@ -15,24 +19,18 @@
1519
</a>
1620
</div>
1721
<div class="flex justify-end gap-7">
18-
<<<<<<< HEAD
19-
<a class:active={currentUrl === "http://localhost:3000/#/team/"} href="#/team/"><p class = "font-bold">Equipa</p></a>
20-
<a class:active={currentUrl === "http://localhost:3000/#/projects/"} href="#/projects/"><p class = "font-bold">Projetos</p></a>
21-
<a class:active={currentUrl === "http://localhost:3000/#/events/"} href="#/events/"><p class = "font-bold">Eventos</p></a>
22-
<a class:active={currentUrl === "http://localhost:3000/#/contacts/"} href="#/contacts/"><p class = "font-bold">Contactos</p></a>
23-
=======
24-
<a href="/#/">Equipa</a>
25-
<a href="/#/">Projetos</a>
26-
<a href="/#/">Eventos</a>
27-
<a href="/contacts">Contactos</a>
28-
>>>>>>> c06cc9d4ec9d3ef94d256019af7eb47b0e9b5b6d
22+
{#each links as {href, label, pageComp}}
23+
<a class:active={currentPage === pageComp} href={href}>
24+
<p class = "font-bold">{label}</p>
25+
</a>
26+
{/each}
2927
</div>
3028
</nav>
3129

3230
<style>
3331
.active {
34-
background-color: rgba(116, 20, 20, 0.4);
35-
padding: 2px 3px;
32+
background-color: theme('colors.muted-red.400');
33+
padding: 2px 6px;
3634
border-radius: 4px;
3735
}
3836
</style>

0 commit comments

Comments
 (0)