<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>