1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
<script>
// This is a list of variables that we can change
let variables = [
{id: 1, name: "Speed", type: "range", value: 20, min: 0, max: 100},
{id: 2, name: "Tingle intensity", type: "range", value: 40, min: 0, max: 255},
{id: 3, name: "Amount of tingle", type: "range", value: 90, min: 0, max: 100},
{id: 4, name: "Variable of unknown type", type: "date", value: "January"}
];
</script>
<style>
.wrapper {
width: 100%;
box-sizing: border-box;
border-radius: 15px;
margin-top: 15px;
padding: 15px;
text-align: left;
}
input {
width: 100%;
}
</style>
<div class="wrapper drop-shadow">
{#each variables as variable}
<label for={variable.id}>{variable.name}</label>
{#if variable.type == "range"}
<input type="range" id={variable.id} min={variable.min} max={variable.max} value={variable.value}>
{:else}
<input type="text" id={variable.id} value={variable.value} />
{/if}
{/each}
</div>
|