Update Tag.js

This commit is contained in:
Rohit Tanwar
2018-03-07 17:07:26 +05:30
committed by GitHub
parent 2f32e99fb7
commit f9b0bd2e7b

View File

@ -1,14 +1,27 @@
import { select, selectAll, on } from '../deps/utils'
const tagButtons = selectAll('button.tags__tag')
let isShiftSelected = false;
const onClick = function() {
if(isShiftSelected){
document.querySelector.classList.remove('is-active')
}
else{
tagButtons.forEach(button => button.classList.remove('is-active'))
}
this.classList.add('is-active')
EventHub.emit('Tag.click', {
type: this.dataset.type
})
}
onkeydown = e => (
if(e.shiftKey){
isShiftSelected = true;
});
onkeyup = e => (
if(e.shiftKey){
isShiftSelected = false;
});
tagButtons.forEach(button => on(button, 'click', onClick))