import { Controller } from '@hotwired/stimulus';

export default class extends Controller<HTMLElement> {
   showSubmenu(e): void {
      const self = e.target as HTMLElement;
      setTimeout(() => {
         if (self.matches(":hover")) {
            self.classList.add("is-hover");
         }
      }, 200);
   }

   hideSubmenu(e): void {
      const self = e.target as HTMLElement;
      setTimeout(() => {
         if (!self.matches(":hover")) {
            self.classList.remove("is-hover");
         }
      }, 250);
   }
}
