🐛 Fixes type error

This commit is contained in:
Daniel Svitan 2024-03-04 18:42:30 +01:00
parent 75aed63005
commit 180faecddf
2 changed files with 11 additions and 9 deletions

2
.gitignore vendored
View File

@ -26,3 +26,5 @@ dist-ssr
bun.lockb bun.lockb
package-lock.json package-lock.json
.vscode/ .vscode/
.firebaserc
firebase.json

View File

@ -17,16 +17,11 @@
<div v-if="problem" class="flex"> <div v-if="problem" class="flex">
<div class="flex items-end justify-center flex-col h-full gap-y-2 p-2"> <div class="flex items-end justify-center flex-col h-full gap-y-2 p-2">
<Number <Number :number="problem.a" :options="options" class="mx-2" />
:number="problem.a"
:options="{ spacing: +spacing, fill: fill }"
class="mx-2"
/>
<Number <Number
:number="problem.b" :number="problem.b"
:options="{ :options="{
spacing: +spacing, ...options,
fill: fill,
prefix: problem.operator, prefix: problem.operator,
}" }"
class="mx-2" class="mx-2"
@ -37,7 +32,7 @@
<Number <Number
:data-shown="shown" :data-shown="shown"
:number="problem.answer" :number="problem.answer"
:options="{ spacing: +spacing, fill: fill }" :options="options"
class="mx-2 data-[shown=false]:opacity-0" class="mx-2 data-[shown=false]:opacity-0"
/> />
</div> </div>
@ -93,7 +88,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref } from "vue"; import { computed, onMounted, ref } from "vue";
import { levels, Problem } from "./composables/levels.ts"; import { levels, Problem } from "./composables/levels.ts";
import Number from "./components/Number.vue"; import Number from "./components/Number.vue";
@ -104,6 +99,11 @@ const shown = ref(false);
const openSettings = ref(false); const openSettings = ref(false);
const spacing = ref("4"); const spacing = ref("4");
const fill = ref(true); const fill = ref(true);
const options = computed(() => ({
spacing: +spacing.value,
fill: fill.value,
prefix: undefined,
}));
function next() { function next() {
problem.value = levels[level.value].generate(); problem.value = levels[level.value].generate();