Skip to content

Commit

Permalink
Corrections about styles in nav
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanEstrada003 committed Aug 5, 2024
1 parent 81ff26b commit 99694ef
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 8 deletions.
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: 2 additions & 2 deletions 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";
import Navbar from "./components/Navbar.svelte";
let { children } = $props();
</script>

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

<Navbar/>
<Navbar />

<Toaster richColors closeButton />
{@render children()}
90 changes: 84 additions & 6 deletions src/routes/components/Navbar.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,85 @@
<nav>
<a href="/">Inicio</a>
<a href="/events">Eventos</a>
<a href="/projects">Proyectos</a>
<a href="/contact">Contacto</a>
<a href="/member">Miembros</a>
<script lang="ts">
import { page } from "$app/stores";
import { derived } from "svelte/store";
import logo from "$lib/assets/images/logo.png";
// Derivar la ruta actual desde el store de la página
const path = derived(page, ($page) => $page.url.pathname);
// Variable que mantiene el path actual
let currentPath: string;
// Suscribirse al store para obtener actualizaciones
path.subscribe((value) => {
currentPath = value;
});
</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">
<!-- Enlace Inicio -->
<a href="/" class="hover:underline">
{#if currentPath === "/"}
<span class="font-bold text-green-400">
<span class="text-green-400">{"{"}</span>
<span class="text-white">Inicio</span>
<span class="text-green-400">{"}"}</span>
</span>
{:else}
Inicio
{/if}
</a>
<!-- Enlace Eventos -->
<a href="/events" class="hover:underline">
{#if currentPath === "/events"}
<span class="font-bold text-green-400">
<span class="text-green-400">{"{"}</span>
<span class="text-white">Eventos</span>
<span class="text-green-400">{"}"}</span>
</span>
{:else}
Eventos
{/if}
</a>
<!-- Enlace Proyectos -->
<a href="/projects" class="hover:underline">
{#if currentPath === "/projects"}
<span class="font-bold text-green-400">
<span class="text-green-400">{"{"}</span>
<span class="text-white">Proyectos</span>
<span class="text-green-400">{"}"}</span>
</span>
{:else}
Proyectos
{/if}
</a>
<!-- Enlace Contacto -->
<a href="/contact" class="hover:underline">
{#if currentPath === "/contact"}
<span class="font-bold text-green-400">
<span class="text-green-400">{"{"}</span>
<span class="text-white">Contacto</span>
<span class="text-green-400">{"}"}</span>
</span>
{:else}
Contacto
{/if}
</a>
<!-- Enlace Miembros -->
<a href="/member" class="hover:underline">
{#if currentPath === "/member"}
<span class="font-bold text-green-400">
<span class="text-green-400">{"{"}</span>
<span class="text-white">Miembros</span>
<span class="text-green-400">{"}"}</span>
</span>
{:else}
Miembros
{/if}
</a>
</div>
<div class="absolute bottom-0 left-0 z-0 h-px w-full bg-green-500"></div>
</nav>

0 comments on commit 99694ef

Please sign in to comment.