Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navbar #44

Merged
merged 4 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
Loading