Skip to content

Commit

Permalink
remove goto
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniele Ciminieri committed Sep 18, 2024
1 parent c06f0c0 commit aa773cc
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/routes/gruppi/[slug]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
import { base } from '$app/paths';
import DataProject from '$lib/components/DataProject.svelte';
import ExperienceProject from '$lib/components/ExperienceProject.svelte';
import { goto } from '$app/navigation';
const { data } = $props();
$inspect(data);
const sortedProjects = $derived(
data.gruppo.progetti.sort((a, b) => {
if (a.modulo < b.modulo) return -1;
Expand All @@ -14,10 +12,6 @@
})
);
const navigateToGroup = (slug) => {
goto(`${base}/gruppi/${slug}`);
};
let currentIndex = $state(-1);
$effect(() => {
currentIndex = data?.gruppo?.gruppi?.findIndex(
Expand Down Expand Up @@ -91,27 +85,27 @@
<div class="row justify-content-between">
{#if data.gruppo.prev}
<div class="col-auto d-flex align-items-center">
<button
<a
href="{base}/gruppi/{data.gruppo.prev.slug.current}"
class="btn rounded-pill d-flex align-items-center justify-content-center hover-effect"
style="--corso-color: #{data.gruppo.corso.colore}; width: 40px; height: 40px;"
onclick={() => navigateToGroup(data.gruppo.prev.slug.current)}
>
<i class="bi bi-arrow-left text-white"></i>
</button>
</a>
<span class="ms-3 fs-5 text-uppercase">Precedente</span>
</div>
{/if}
<div class="col-auto d-flex align-items-center ms-auto">
{#if data.gruppo.next}
<span class="me-3 fs-5 text-uppercase">Successivo</span>
<button
<a
href="{base}/gruppi/{data.gruppo.next.slug.current}"
class="btn rounded-pill d-flex align-items-center justify-content-center hover-effect"
style="--corso-color: #{data.gruppo.corso.colore}; width: 40px; height: 40px;"
onclick={() => navigateToGroup(data.gruppo.next.slug.current)}
>
<i class="bi bi-arrow-right text-white"></i>
</button>
</a>
{/if}
</div>
</div>
Expand Down

0 comments on commit aa773cc

Please sign in to comment.