From cd1517c9daaf0d7e30fbfe9fde62cafdb3127064 Mon Sep 17 00:00:00 2001 From: Xevion Date: Fri, 18 Dec 2020 18:59:03 -0600 Subject: [PATCH] improve settings menu programatic organization, better button styling --- src/arithmetic.js | 46 +++++++++++++++++++++++++++++---- src/components/SettingsMenu.vue | 34 +++++++++++++++++++++++- src/problems.js | 7 +++++ src/scss/buefy.scss | 17 ++++++++++++ 4 files changed, 98 insertions(+), 6 deletions(-) create mode 100644 src/problems.js diff --git a/src/arithmetic.js b/src/arithmetic.js index aeb95a6..ac9872b 100644 --- a/src/arithmetic.js +++ b/src/arithmetic.js @@ -1,4 +1,4 @@ -import utils from './utils.js'; +import utils from '@/utils'; export default { methods: { @@ -14,18 +14,17 @@ export default { subtraction(mult = 1) { let a = utils.methods.getRandomInt(5 * mult, 100 * mult); let b = utils.methods.getRandomInt(5 * mult, 100 * mult); - if (Math.random() > 0.5) { + if (Math.random() > 0.5) return { text: `${a} - ${b}`, answer: a - b, } - } - else { + else return { text: `-${a} + ${b}`, answer: -a + b } - } + }, multiplication(mult = 1) { let a = utils.methods.getRandomInt(3 * mult, 30 * mult); @@ -56,5 +55,42 @@ export default { let index = utils.methods.getRandomInt(0, possible.length); return possible[index](); } + }, + data() { + let self = this; + return { + problems: [ + { + name: 'Addition', + id: 'addition', + difficulties: [ + { + id: 'easy', + name: 'Easy', + options: { + multiplier: 1 + } + }, + { + id: 'hard', + name: 'Hard', + options: { + multiplier: 2.5 + } + }, + { + id: 'very_hard', + name: 'Very Hard', + options: { + multiplier: 4 + } + } + ], + method: self.addition, + enabled: true, + current: 0 + } + ] + } } } diff --git a/src/components/SettingsMenu.vue b/src/components/SettingsMenu.vue index 24163dc..249e948 100644 --- a/src/components/SettingsMenu.vue +++ b/src/components/SettingsMenu.vue @@ -5,6 +5,25 @@ @@ -14,14 +33,27 @@ diff --git a/src/problems.js b/src/problems.js new file mode 100644 index 0000000..795028b --- /dev/null +++ b/src/problems.js @@ -0,0 +1,7 @@ +import arithmetic from "@/arithmetic"; + +export default { + data: () => { + return arithmetic.data().problems + } +} diff --git a/src/scss/buefy.scss b/src/scss/buefy.scss index b09586c..43b18ce 100644 --- a/src/scss/buefy.scss +++ b/src/scss/buefy.scss @@ -13,6 +13,23 @@ $modal-background-background-color: bulmaRgba($scheme-main, 0.6); $modal-card-body-background-color: darken($background, 4%); $border: darken($modal-background-background-color, 30%); +$grey-darker: hsl(0, 0%, 58%); +$grey-dark: hsl(0, 0%, 53%); +$grey: hsl(0, 0%, 42%); +$grey-light: hsl(0, 0%, 32%); +$grey-lightest: hsl(0, 0%, 22%); + +$button-border-width: 0; +$button-hover-color: $grey-darker; + // Import Bulma and Buefy styles @import "~bulma"; @import "~buefy/src/scss/buefy"; + +// Special button class that disables hover/active/focus effects +.button.button-unhoverable { + &:hover, &:active, &:focus, .is-hovered, .is-active, .is-focused { + border-color: $button-border-color; + color: $text-strong !important; + } +}