const resizeElement = (el) => {
  el.style.height = `auto`;
  el.style.height = `${el.clientHeight - el.offsetHeight + el.scrollHeight}px`;
};

export default {
  update: resizeElement,
  inserted: resizeElement,
  bind(el, binding, vnode) {
    el.classList.add('skillbox-auto-grow');
    el.addEventListener('input', event => {
      resizeElement(el);
    });
  },
  unbind(el) {
    el.classList.remove('skillbox-auto-grow');
    el.removeEventListener('input', event => {
      resizeElement(el);
    });
  }
};
