Skip to content

Commit

Permalink
Add Navbar (#44)
Browse files Browse the repository at this point in the history
* Create component nav

* Components

* Corrections about styles in nav

* Refactor

---------

Co-authored-by: Adrian Delgado <[email protected]>
  • Loading branch information
BryanEstrada003 and adriandelgado authored Aug 5, 2024
1 parent 5c14cf3 commit ecffc6e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
Binary file added src/lib/assets/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import "../app.postcss";
import { Toaster } from "svelte-sonner";
import { page } from "$app/stores";
import Navbar from "./components/Navbar.svelte";
let { children } = $props();
</script>

Expand All @@ -11,5 +11,7 @@
<meta name="description" content={$page.data.description} />
</svelte:head>

<Navbar />

<Toaster richColors closeButton />
{@render children()}
34 changes: 34 additions & 0 deletions src/routes/components/Navbar.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<script lang="ts">
import { page } from "$app/stores";
import logo from "$lib/assets/images/logo.png";
const current_path = $derived($page.url.pathname);
const LINKS = [
{ text: "Inicio", href: "/" },
{ text: "Eventos", href: "/events" },
{ text: "Proyectos", href: "/projects" },
{ text: "Contacto", href: "/contact" },
{ text: "Miembros", href: "/members" },
];
</script>

<nav class="relative flex items-center justify-between bg-black p-4">
<div class="flex items-center">
<img src={logo} alt="Logo" class="mr-4 h-10" />
</div>
<div class="flex space-x-8 text-lg text-white">
{#each LINKS as { href, text }}
<a {href} class="font-bold hover:underline">
{#if current_path === href}
<span class="text-green-400">{"{"}</span>
<span>{text}</span>
<span class="text-green-400">{"}"}</span>
{:else}
<span>{text}</span>
{/if}
</a>
{/each}
</div>
<div class="absolute bottom-0 left-0 z-0 h-px w-full bg-green-500"></div>
</nav>

0 comments on commit ecffc6e

Please sign in to comment.