app/src/components/Settings.vue

72 lines
1.9 KiB
Vue

<template>
<div class="settings">
<div class="time">
<p>Kies het aantal seconden:</p>
<span class="time-choice" v-bind:class="{ selected: time == 15 }" v-on:click="setTime(15)">15</span>
<span class="time-choice" v-bind:class="{ selected: time == 30 }" v-on:click="setTime(30)">30</span>
<span class="time-choice" v-bind:class="{ selected: time == 45 }" v-on:click="setTime(45)">45</span>
<span class="time-choice" v-bind:class="{ selected: time == 60 }" v-on:click="setTime(60)">60</span>
<span class="time-choice" v-bind:class="{ selected: time == 75 }" v-on:click="setTime(75)">75</span>
<span class="time-choice" v-bind:class="{ selected: time == 90 }" v-on:click="setTime(90)">90</span>
</div>
<div class="playsound">
<p>Geluid afspelen?</p>
<label class="switch">
<input type="checkbox" class="playSound" v-model="playsound">
<span class="slider round"></span>
</label>
</div>
<button class="start-game" v-on:click="startGame()">Start het spel!</button>
</div>
</template>
<script>
export default {
name: "Settings",
data: function() {
return {
time: 0,
playsound: false,
}
},
methods: {
setTime(time) {
this.time = time
},
setPlaySound() {
let state = document.querySelector(".playSound").checked;
this.playsound = state;
},
startGame() {
this.$emit('set-playsound', this.playsound);
this.$emit('set-time', this.time);
}
}
}
</script>
<style lang="scss">
p { margin-top: 0; margin-bottom: 1em; padding-top: 1em;}
.time-choice {
font-size: 48px;
display: inline-block;
padding: 25px;
&.selected {
color: $red;
}
}
.start-game {
appearance: none;
border: 1px solid $white;
border-radius: 3px;
font-size: 3rem;
background: none;
padding: 2rem;
color: $white;
margin: 1rem;
}
</style>