client/tags: fade out tag colors after 2.5s
This commit is contained in:
parent
af455b901f
commit
81afd383fa
|
@ -174,15 +174,17 @@ input:disabled
|
|||
cursor: not-allowed
|
||||
|
||||
div.tag-input
|
||||
li.implication
|
||||
background: $implied-tag-background-color
|
||||
color: $implied-tag-text-color
|
||||
li.new
|
||||
background: $new-tag-background-color
|
||||
color: $new-tag-text-color
|
||||
li.duplicate
|
||||
background: $duplicate-tag-background-color
|
||||
color: $duplicate-tag-text-color
|
||||
li
|
||||
transition: background-color 0.5s linear
|
||||
&.implication
|
||||
background: $implied-tag-background-color
|
||||
color: $implied-tag-text-color
|
||||
&.new
|
||||
background: $new-tag-background-color
|
||||
color: $new-tag-text-color
|
||||
&.duplicate
|
||||
background: $duplicate-tag-background-color
|
||||
color: $duplicate-tag-text-color
|
||||
ul
|
||||
margin-top: 0.2em
|
||||
|
||||
|
|
|
@ -14,6 +14,21 @@ const SOURCE_INIT = 'init';
|
|||
const SOURCE_IMPLICATION = 'implication';
|
||||
const SOURCE_USER_INPUT = 'user-input';
|
||||
|
||||
function _fadeOutListItemNodeStatus(listItemNode) {
|
||||
if (listItemNode.classList.length) {
|
||||
if (listItemNode.fadeTimeout) {
|
||||
window.clearTimeout(listItemNode.fadeTimeout);
|
||||
}
|
||||
listItemNode.fadeTimeout = window.setTimeout(() => {
|
||||
while (listItemNode.classList.length) {
|
||||
listItemNode.classList.remove(
|
||||
listItemNode.classList.item(0));
|
||||
}
|
||||
listItemNode.fadeTimeout = null;
|
||||
}, 2500);
|
||||
}
|
||||
}
|
||||
|
||||
class TagInputControl extends events.EventTarget {
|
||||
constructor(sourceInputNode) {
|
||||
super();
|
||||
|
@ -140,6 +155,7 @@ class TagInputControl extends events.EventTarget {
|
|||
}
|
||||
this._tagListNode.prependChild(listItemNode);
|
||||
}
|
||||
_fadeOutListItemNodeStatus(listItemNode);
|
||||
}
|
||||
|
||||
_evtTagRemoved(e) {
|
||||
|
|
Loading…
Reference in New Issue