improve settings menu programatic organization, better button styling

This commit is contained in:
Xevion
2020-12-18 18:59:03 -06:00
parent 894e46b95a
commit cd1517c9da
4 changed files with 98 additions and 6 deletions

View File

@@ -5,6 +5,25 @@
<b-icon @click.native="$parent.close()" class="is-clickable" pack="fas" icon="times"></b-icon>
</header>
<section class="modal-card-body">
<b-field addons v-for="(problemType, problemIndex) in problems" :key="problemType.id">
<p class="control">
<b-button class="button-unhoverable" :hovered="false" style="cursor: default;">
{{ problemType.name }}
</b-button>
</p>
<p class="control">
<b-button @click="disableProblem(problemIndex)" :type="!problemType.enabled ? 'is-info' : ''" :selected="!problemType.enabled">
Off
</b-button>
</p>
<p class="control" v-for="(difficulty, difficultyIndex) in problemType.difficulties" :key="difficulty.id">
<b-button :type="problemType.enabled && problemType.current === difficultyIndex ? 'is-info' : ''"
:selected="problemType.enabled && problemType.current === difficultyIndex"
@click.native="selectProblemDifficulty(problemIndex, difficultyIndex)">
{{ difficulty.name }}
</b-button>
</p>
</b-field>
</section>
</div>
</template>
@@ -14,14 +33,27 @@
</style>
<script>
import problems from "@/problems";
export default {
name: 'SettingsMenu',
data() {
return {
levels: []
problems: problems.data()
}
},
created() {
},
methods: {
selectProblemDifficulty(problemIndex, difficultyIndex) {
console.log(`Selected problem ${this.problems[problemIndex].name}, difficulty ${this.problems[problemIndex].difficulties[difficultyIndex].name}`)
this.problems[problemIndex].enabled = true;
this.problems[problemIndex].current = difficultyIndex;
},
disableProblem(problemIndex) {
console.log(`Disabled problem ${this.problems[problemIndex].name}`)
this.problems[problemIndex].enabled = false;
}
}
}
</script>