Skip to content

Commit

Permalink
add input for repl and sync with component state
Browse files Browse the repository at this point in the history
  • Loading branch information
pngwn committed Oct 18, 2020
1 parent 534b9fe commit a26696c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/App.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<script lang="ts">
import Input from "./Input.svelte";
import Output from "./Output.svelte";
import type { Component } from "./types";
let components: Component[] = [
Expand All @@ -20,4 +22,11 @@
source: "<h1>Hello</h1>",
},
];
let current: number = 0;
</script>

<main>
<Input bind:components bind:current />
<Output />
</main>
12 changes: 12 additions & 0 deletions src/Input.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<script lang="ts">
import type { Component } from "./types";
export let components: Component[] = [];
export let current: number = 0;
$: current_component = components.findIndex(({ id }) => id === current);
</script>

<section>
<textarea bind:value={components[current_component].source} />
</section>
2 changes: 2 additions & 0 deletions src/Output.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<script lang="ts">
</script>

0 comments on commit a26696c

Please sign in to comment.