feat: highlight hint icon when hovering the input

This commit is contained in:
kolaente 2023-04-12 18:30:59 +02:00 committed by konrad
parent abb5128426
commit 422d7fc693
2 changed files with 15 additions and 2 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="task-add"> <div class="task-add" ref="taskAdd">
<div class="add-task__field field is-grouped"> <div class="add-task__field field is-grouped">
<p class="control has-icons-left is-expanded"> <p class="control has-icons-left is-expanded">
<textarea <textarea
@ -16,7 +16,7 @@
<span class="icon is-small is-left"> <span class="icon is-small is-left">
<icon icon="tasks"/> <icon icon="tasks"/>
</span> </span>
<quick-add-magic/> <quick-add-magic :highlight-hint-icon="taskAddHovered"/>
</p> </p>
<p class="control"> <p class="control">
<x-button <x-button
@ -44,6 +44,7 @@
<script setup lang="ts"> <script setup lang="ts">
import {computed, ref} from 'vue' import {computed, ref} from 'vue'
import {useI18n} from 'vue-i18n' import {useI18n} from 'vue-i18n'
import {useElementHover} from '@vueuse/core'
import {RELATION_KIND} from '@/types/IRelationKind' import {RELATION_KIND} from '@/types/IRelationKind'
import type {ITask} from '@/modelTypes/ITask' import type {ITask} from '@/modelTypes/ITask'
@ -84,6 +85,9 @@ const taskStore = useTaskStore()
// newTaskInput.value.focus() // newTaskInput.value.focus()
// }) // })
const taskAdd = ref<HTMLTextAreaElement | null>(null)
const taskAddHovered = useElementHover(taskAdd)
const errorMessage = ref('') const errorMessage = ref('')
function resetEmptyTitleError(e: KeyboardEvent) { function resetEmptyTitleError(e: KeyboardEvent) {

View File

@ -5,6 +5,7 @@
class="icon is-small show-helper-text" class="icon is-small show-helper-text"
v-tooltip="$t('task.quickAddMagic.hint')" v-tooltip="$t('task.quickAddMagic.hint')"
:aria-label="$t('task.quickAddMagic.hint')" :aria-label="$t('task.quickAddMagic.hint')"
:class="{'is-highlighted': highlightHintIcon}"
> >
<icon :icon="['far', 'circle-question']"/> <icon :icon="['far', 'circle-question']"/>
</BaseButton> </BaseButton>
@ -104,6 +105,10 @@ import {PREFIXES} from '@/modules/parseTaskText'
const visible = ref(false) const visible = ref(false)
const mode = ref(getQuickAddMagicMode()) const mode = ref(getQuickAddMagicMode())
const props = defineProps<{
highlightHintIcon: boolean,
}>()
const prefixes = computed(() => PREFIXES[mode.value]) const prefixes = computed(() => PREFIXES[mode.value])
</script> </script>
@ -111,5 +116,9 @@ const prefixes = computed(() => PREFIXES[mode.value])
.show-helper-text { .show-helper-text {
right: 0; right: 0;
pointer-events: auto !important; pointer-events: auto !important;
&.is-highlighted {
color: inherit !important;
}
} }
</style> </style>