feat(#5): Add the ability to select pre-defined card sets

This commit is contained in:
Josh Creek
2023-07-30 17:01:00 +01:00
parent 7dd7605aee
commit 236588307b
5 changed files with 108 additions and 28 deletions
+21 -18
View File
@@ -1,28 +1,31 @@
<script lang="ts">
export let values: Array<number | string> = [1, 2, 3, 5, 8, 13, 21, '?'];
export let values: Array<number | string>;
export let onEstimateClick: (value: number | string) => void;
export let disableEstimates: boolean = false;
</script>
<div id="estimates-list">
<div class="centered-container">
{#each values as value}
<button
disabled={disableEstimates}
class="{disableEstimates ? 'estimate-card disabled' : 'estimate-card'}"
on:click={() => onEstimateClick(value)}
on:keydown={(event) => {
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault();
onEstimateClick(value);
}
}}
aria-label={`Estimate: ${value}`}
tabindex="0"
>
<p class="value">{value}</p>
</button>
{/each}
{#if values !== undefined}
{#each values as value}
<button
disabled={disableEstimates}
class="{disableEstimates ? 'estimate-card disabled' : 'estimate-card'}"
on:click={() => onEstimateClick(value)}
on:keydown={(event) => {
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault();
onEstimateClick(value);
}
}}
aria-label={`Estimate: ${value}`}
tabindex="0"
>
<p class="value">{value}</p>
</button>
{/each}
{/if}
</div>
</div>