forked from MapComplete/MapComplete
Studio: Add introductory slideshow to Studio
This commit is contained in:
parent
b7a88ced70
commit
0d25a7fa7b
11 changed files with 359 additions and 2 deletions
0
src/UI/Studio/ChooseLayerToEdit.svelte
Normal file
0
src/UI/Studio/ChooseLayerToEdit.svelte
Normal file
32
src/UI/Walkthrough/Walkthrough.svelte
Normal file
32
src/UI/Walkthrough/Walkthrough.svelte
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<script lang="ts">
|
||||
|
||||
import * as nmd from "nano-markdown";
|
||||
import { createEventDispatcher } from "svelte";
|
||||
import WalkthroughStep from "./WalkthroughStep.svelte";
|
||||
import FromHtml from "../Base/FromHtml.svelte";
|
||||
|
||||
/**
|
||||
* Markdown
|
||||
*/
|
||||
export let pages: string[];
|
||||
|
||||
let currentPage: number = 0;
|
||||
|
||||
const dispatch = createEventDispatcher<{ done }>();
|
||||
|
||||
function step(incr: number) {
|
||||
if (incr > 0 && currentPage + 1 === pages.length) {
|
||||
dispatch("done");
|
||||
currentPage = 0
|
||||
return
|
||||
}
|
||||
currentPage = Math.min(Math.max(0, currentPage + incr), pages.length);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<WalkthroughStep on:back={() => step(-1)} on:next={() => step(1)}>
|
||||
<FromHtml src={nmd(pages[currentPage])} />
|
||||
</WalkthroughStep>
|
||||
|
||||
34
src/UI/Walkthrough/WalkthroughStep.svelte
Normal file
34
src/UI/Walkthrough/WalkthroughStep.svelte
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<script lang="ts">
|
||||
|
||||
import BackButton from "../Base/BackButton.svelte";
|
||||
import NextButton from "../Base/NextButton.svelte";
|
||||
import { createEventDispatcher } from "svelte";
|
||||
|
||||
const dispatch = createEventDispatcher<{ back, next }>();
|
||||
export let islast = false;
|
||||
export let isFirst = false
|
||||
</script>
|
||||
|
||||
|
||||
<div class="flex flex-col h-full w-full justify-between">
|
||||
|
||||
<div class="overflow-y-auto">
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
<div class="flex w-full">
|
||||
{#if !isFirst}
|
||||
<BackButton clss="w-full" on:click={() => dispatch("back")}>
|
||||
Back
|
||||
</BackButton>
|
||||
{/if}
|
||||
<NextButton clss="primary w-full" on:click={() => dispatch("next")}>
|
||||
{#if islast}
|
||||
Finish
|
||||
{:else}
|
||||
Next
|
||||
{/if}
|
||||
</NextButton>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue