Skip to content

Commit

Permalink
added basepaths
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniele Ciminieri committed Sep 18, 2024
1 parent fc89b08 commit 1b517f2
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 18 deletions.
5 changes: 3 additions & 2 deletions src/lib/components/Header.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script>
import { browser } from '$app/environment';
import { base } from '$app/paths';
let lastScrollTop = 0;
let headerElement;
Expand Down Expand Up @@ -33,11 +34,11 @@
<div class="row d-flex justify-content-between align-items-center h-100">
<div class="col-auto">
<h4 class="mb-0 text-uppercase">
<a class="text-white text-decoration-none" href="/">Information design lab</a>
<a class="text-white text-decoration-none" href="{base}/">Information design lab</a>
</h4>
</div>
<div class="col-auto d-none d-md-block">
<img class="logo" src="/logo_srm.png" alt="Information design lab" />
<img class="logo" src="{base}/logo_srm.png" alt="Information design lab" />
</div>
</div>
</div>
Expand Down
12 changes: 0 additions & 12 deletions src/lib/stores/colorStore.svelte.js

This file was deleted.

3 changes: 2 additions & 1 deletion src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script>
import { base } from '$app/paths';
const page = $props();
const corsi = $derived(page.data.corsi);
</script>
Expand Down Expand Up @@ -52,7 +53,7 @@
>
<div class="col-12">
<h1 class="d-flex align-items-center gap-3">
<a href={`corsi/${corso.slug.current}`} class="text-decoration-none text-white">
<a href="{base}/corsi/{corso.slug.current}" class="text-decoration-none text-white">
<span class="fw-normal">{corso.titolo}</span>
</a>
<span
Expand Down
3 changes: 2 additions & 1 deletion src/routes/corsi/[slug]/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script>
import { base } from '$app/paths';
const { data } = $props();
</script>

Expand Down Expand Up @@ -33,7 +34,7 @@
class:border-top={index !== 0}
class:border-bottom={index !== data.corso.gruppi.length - 1}
>
<a href={`/gruppi/${gruppo.slug.current}`} class="text-decoration-none text-white">
<a href="{base}/gruppi/{gruppo.slug.current}" class="text-decoration-none text-white">
<h1 class="fw-normal text-uppercase">{gruppo.nome}</h1>
</a>
</div>
Expand Down
19 changes: 17 additions & 2 deletions src/routes/gruppi/[slug]/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script>
import { base } from '$app/paths';
import DataProject from '$lib/components/DataProject.svelte';
import ExperienceProject from '$lib/components/ExperienceProject.svelte';
import { goto } from '$app/navigation';
Expand All @@ -13,8 +14,22 @@
);
const navigateToGroup = (slug) => {
goto(`/gruppi/${slug}`);
goto(`${base}/gruppi/${slug}`);
};
let currentIndex = $state(-1);
$effect(() => {
currentIndex = data?.gruppo?.gruppi?.findIndex(
(g) => g.slug.current === data?.gruppo?.slug?.current
);
});
const prevIndex = $derived(currentIndex > 0 ? currentIndex - 1 : data.gruppo.gruppi.length - 1);
const nextIndex = $derived(currentIndex < data.gruppo.gruppi.length - 1 ? currentIndex + 1 : 0);
const prevGroup = $derived(data.gruppo.gruppi[prevIndex]);
const nextGroup = $derived(data.gruppo.gruppi[nextIndex]);
</script>
{#if data.gruppo}
Expand All @@ -23,7 +38,7 @@
<div class="col-md-12 border-bottom border-white py-2">
<h1 class="d-flex align-items-center gap-3">
<a
href={`/corsi/${data.gruppo.corso.slug.current}`}
href="{base}/corsi/{data.gruppo.corso.slug.current}"
class="text-decoration-none text-white"
>
<span class="fw-normal">{data.gruppo.corso.titolo}</span>
Expand Down

0 comments on commit 1b517f2

Please sign in to comment.