New category input improvements

This commit is contained in:
2021-11-06 00:24:59 +03:00
parent 85ed1e05e5
commit 6cd4a91ec7
2 changed files with 10 additions and 3 deletions

View File

@@ -5,7 +5,8 @@
v-model="newCategory"
placeholder="New category"
@keypress.enter="addCategory"
@mouseenter="newCategory = ''"
@click="hoverInput"
@mouseenter="hoverInput"
@mouseleave="blurInput"
/>
<div class="categories">
@@ -44,11 +45,16 @@ export default {
removeCategory(category) {
this.$store.commit('removeCategory', category);
if (category === this.selectedCategory) {
this.selectedCategory();
this.selectCategory();
}
},
hoverInput(event) {
this.newCategory = '';
event.target.classList.add('hover');
},
blurInput(event) {
this.newCategory = '+';
event.target.classList.remove('hover');
event.target.blur();
},
stringToColor(str) {
@@ -93,7 +99,7 @@ export default {
box-sizing: border-box;
transition: width 0.6s;
&:hover {
&.hover {
width: 220px;
}
}

View File

@@ -10,6 +10,7 @@ export default createStore({
categories: [],
tasks: [],
midnightReset: false,
lastReset: undefined,
darkTheme: true,
},
mutations: {