Fix route slug
This commit is contained in:
parent
33bbf50a2d
commit
0143a16042
2 changed files with 57 additions and 48 deletions
|
@ -1,28 +1,30 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Header from '$lib/components/Header.svelte';
|
import Header from '$lib/components/Header.svelte';
|
||||||
import Tabs from '$lib/components/Tabs.svelte';
|
import Tabs from '$lib/components/Tabs.svelte';
|
||||||
import MapTab from '$lib/components/tabs/MapTab.svelte';
|
import { onMount } from 'svelte';
|
||||||
|
|
||||||
|
export let data: App.Route;
|
||||||
|
|
||||||
export let data;
|
|
||||||
let divider;
|
let divider;
|
||||||
|
|
||||||
const mapClick = (evt) => {
|
onMount(async () => {
|
||||||
}
|
console.log(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapClick = (evt) => {};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<Header></Header>
|
<Header></Header>
|
||||||
<img src='/images/splash-background.webp' alt='splash'>
|
<img src="/images/splash-background.webp" alt="splash" />
|
||||||
|
|
||||||
<div bind:this={divider} id='divider'>
|
<div bind:this={divider} id="divider">
|
||||||
<div id='banner'>
|
<div id="banner">
|
||||||
<p>Percorso <b>{data.name}</b></p>
|
<p>Percorso <b>{data.name_it}</b></p>
|
||||||
<p id='duration'>Durata {Math.floor(Number(data.duration) / 60)}'</p>
|
<p id="duration">Dislivello {data.elevation_gain}</p>
|
||||||
</div>
|
</div>
|
||||||
<Tabs on:map-click={mapClick}></Tabs>
|
<Tabs on:map-click={mapClick} route={data}></Tabs>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
#divider {
|
#divider {
|
||||||
background: white;
|
background: white;
|
||||||
|
|
7
frontend/src/routes/routes/[slug]/+page.ts
Normal file
7
frontend/src/routes/routes/[slug]/+page.ts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import { getRoute } from '$lib/repo.js';
|
||||||
|
import { error } from '@sveltejs/kit';
|
||||||
|
|
||||||
|
/** @type {import('./$types').PageLoad} */
|
||||||
|
export async function load({ params }) {
|
||||||
|
return await getRoute(params.slug);
|
||||||
|
}
|
Loading…
Reference in a new issue