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

37 lines
605 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
}
3 years ago
</script>
<style>
.level {
cursor: pointer;
margin-right: 10px;
}
:global(body) {
background-color: #eceff4;
margin: 0;
padding: 15px;
}
</style>
3 years ago
<main>
<Triangle {side} {variant} />
{#each levels as _, value}
<button
class="level"
on:click={changeLevel}
{value}>{value + 1}</button>
{/each}
3 years ago
</main>