feat: add back button fucntionality

This commit is contained in:
Arman
2022-06-14 12:11:59 +02:00
parent db79112194
commit 8423d2b567
2 changed files with 12 additions and 2 deletions
+11 -2
View File
@@ -1,6 +1,7 @@
<script lang="ts">
import { navigating, page } from '$app/stores';
import { tabs, title } from '$lib/stores/layout';
import { Back } from '$lib/components';
import { tabs, title, backButton } from '$lib/stores/layout';
import { fade } from 'svelte/transition';
import { Cover } from '.';
@@ -69,7 +70,15 @@
</nav>
<section class="main-content">
<Cover>
<svelte:fragment slot="title">{$title}</svelte:fragment>
<svelte:fragment slot="title">
{#if $backButton}
<Back href={$backButton}>
{$title}
</Back>
{:else}
{$title}
{/if}
</svelte:fragment>
{#if $tabs.length}
<div class="tabs">
{#if showLeft}
+1
View File
@@ -6,4 +6,5 @@ export type Tab = {
};
export const title = writable<string>('');
export const backButton = writable<string>('');
export const tabs = writable<Tab[]>([]);