You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
triangles.fun/src/App.svelte

29 lines
485 B

3 years ago
<script>
import Triangle from "./Triangle.svelte"
import { levels } from "./levels.js"
let level = 0
$: variant = levels[level].variant
$: side = levels[level].side
const changeLevel = event => {
level = event.target.value
}
$: console.log(level)
3 years ago
</script>
<style>
button {
margin-right: 10px;
}
</style>
3 years ago
<main>
<Triangle {side} {variant} />
{#each levels as _, value}
<button on:click={changeLevel} {value}>{value}</button>
{/each}
3 years ago
</main>