File size: 1,502 Bytes
ca5bd83
153471c
72db8a4
ca5bd83
72db8a4
ca5bd83
 
 
72db8a4
ca5bd83
 
153471c
ca5bd83
075b025
ca5bd83
153471c
ca5bd83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<script lang="ts">
import { style } from './stores';
import { styles } from './config.json';

const keys: string[] = Object.keys(styles);
</script>

<fieldset>
  <legend>{styles[$style] || 'Synthesizer'}</legend>
  <div class="grid">
    {#each keys as key, i}
      <label data-selected={$style === key}>
        <div>
          <img src={`static/${key}.svg`} alt={styles[key]} />
        </div>
        <input type="radio" bind:group={$style} value={key} />
      </label>
    {/each}
  </div>
</fieldset>

<style>
fieldset {
  position: relative;
  padding: 0;
  border: none;
  margin-top: 1rem;
}

legend {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  padding: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  width: min-content;
  margin: 1rem auto;
}

img {
  width: 100%;
  height: 100%;
  filter: invert(1);
  margin: auto;
}

label {
  background-color: transparent;
  border-radius: 0.375rem;
  transition: background-color 0.25s;
  cursor: pointer;
}

label > div {
  width: 3rem;
  aspect-ratio: 1 / 1;
}

input {
  position: fixed;
  opacity: 0;
  pointer-events: none;
}

label[data-selected='true'] {
  background-color: hsl(0 0% 97%);
  border-radius: 0.375rem;
}

label[data-selected='true'] img {
  filter: none;
}

@media (min-width: 600px) and (max-width: 899px) {
  .grid {
    display: flex;
    flex-direction: row;
  }
}

@media (min-width: 900px) {
  .grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
</style>