refactor: simplify answer logic
This commit is contained in:
parent
b216bae284
commit
fe7b8bbed1
1 changed files with 4 additions and 16 deletions
|
@ -1,8 +1,7 @@
|
|||
<script lang="ts">
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
let hasImpact = false;
|
||||
let hasAnswered = false;
|
||||
let hasImpact: boolean;
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
|
@ -18,23 +17,12 @@
|
|||
</header>
|
||||
|
||||
<main>
|
||||
{#if !hasAnswered}
|
||||
{#if hasImpact === undefined}
|
||||
<form transition:fade={{ delay: 0, duration: 300 }}>
|
||||
<h1>Does this have impact?</h1>
|
||||
|
||||
<button
|
||||
on:click={() => {
|
||||
hasImpact = true;
|
||||
hasAnswered = true;
|
||||
}}>Yes</button
|
||||
>
|
||||
|
||||
<button
|
||||
on:click={() => {
|
||||
hasImpact = false;
|
||||
hasAnswered = true;
|
||||
}}>No</button
|
||||
>
|
||||
<button on:click={() => (hasImpact = true)}>Yes</button>
|
||||
<button on:click={() => (hasImpact = false)}>No</button>
|
||||
</form>
|
||||
{:else}
|
||||
<div transition:fade={{ delay: 300, duration: 500 }} id="answer">
|
||||
|
|
Loading…
Reference in a new issue