mirror of
https://github.com/Xevion/power-math.git
synced 2025-12-06 01:15:48 -06:00
katex example rendering inside tooltip
has issues on the top row where the modal-card-header overlaps
This commit is contained in:
@@ -7,21 +7,31 @@
|
||||
<section class="modal-card-body">
|
||||
<b-field addons class="is-flex mb-1" v-for="(problemType, problemIndex) in problems" :key="problemType.id">
|
||||
<p class="control is-flex-grow-0" style="min-width: 150px;">
|
||||
<b-button class="button-unhoverable is-block darker w-100" :hovered="false" style="cursor: default;">
|
||||
<b-button class="button-unhoverable is-block darker w-100" :hovered="false"
|
||||
style="cursor: default;">
|
||||
{{ problemType.name }}
|
||||
</b-button>
|
||||
</p>
|
||||
<p class="control is-flex-grow-2">
|
||||
<b-button class="w-100" @click="disableProblem(problemIndex)" :type="!problemType.enabled ? 'is-info' : ''" :selected="!problemType.enabled">
|
||||
<b-button class="w-100" @click="disableProblem(problemIndex)"
|
||||
:type="!problemType.enabled ? 'is-info' : ''" :selected="!problemType.enabled">
|
||||
Off
|
||||
</b-button>
|
||||
</p>
|
||||
<p class="control is-flex-grow-2" v-for="(difficulty, difficultyIndex) in problemType.difficulties" :key="difficulty.id">
|
||||
<b-button class="w-100" :type="problemType.enabled && problemType.current === difficultyIndex ? (difficulty.style || 'is-info') : ''"
|
||||
:selected="problemType.enabled && problemType.current === difficultyIndex"
|
||||
@click.native="selectProblemDifficulty(problemIndex, difficultyIndex)">
|
||||
{{ difficulty.name }}
|
||||
</b-button>
|
||||
<p class="control is-flex-grow-2" v-for="(difficulty, difficultyIndex) in problemType.difficulties"
|
||||
:key="difficulty.id">
|
||||
<b-tooltip class="w-100" type="is-dark" :animated="false">
|
||||
<b-button class="w-100"
|
||||
:type="problemType.enabled && problemType.current === difficultyIndex ? (difficulty.style || 'is-info') : ''"
|
||||
:selected="problemType.enabled && problemType.current === difficultyIndex"
|
||||
@click.native="selectProblemDifficulty(problemIndex, difficultyIndex)"
|
||||
>
|
||||
{{ difficulty.name }}
|
||||
</b-button>
|
||||
<template v-slot:content>
|
||||
<katex-element :expression="getExample(problemIndex, difficultyIndex)"/>
|
||||
</template>
|
||||
</b-tooltip>
|
||||
</p>
|
||||
</b-field>
|
||||
</section>
|
||||
@@ -40,17 +50,17 @@ export default {
|
||||
props: {
|
||||
problems
|
||||
},
|
||||
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;
|
||||
},
|
||||
getExample(problemIndex, difficultyIndex) {
|
||||
let problemType = this.problems[problemIndex];
|
||||
return problemType.method(problemType.difficulties[difficultyIndex].options).text
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Vue from 'vue'
|
||||
import VueKatex from 'vue-katex';
|
||||
import {ConfigProgrammatic, Input, Field, Button, Icon, Modal} from 'buefy';
|
||||
import {ConfigProgrammatic, Input, Field, Button, Icon, Modal, Tooltip} from 'buefy';
|
||||
import {library} from '@fortawesome/fontawesome-svg-core';
|
||||
import {faCog, faTimes} from "@fortawesome/free-solid-svg-icons";
|
||||
import {FontAwesomeIcon} from "@fortawesome/vue-fontawesome";
|
||||
@@ -18,6 +18,8 @@ Vue.use(Field);
|
||||
Vue.use(Button);
|
||||
Vue.use(Icon);
|
||||
Vue.use(Modal);
|
||||
Vue.use(Tooltip);
|
||||
|
||||
ConfigProgrammatic.setOptions({
|
||||
defaultIconComponent: 'vue-fontawesome',
|
||||
defaultIconPack: 'fas'
|
||||
|
||||
Reference in New Issue
Block a user