<script>
  import UiNavbarSubitem from "./NavbarSubitem";
  import screens from "../../../../screens";

  const lgScreenSize = parseInt(screens.lg.replace("px", ""), 10);

  export default {
    components: {
      UiNavbarSubitem
    },
    data() {
      return {
        isLgScreenSize: this.getWindowWidth() >= lgScreenSize,
        show: false,
        resizeHandler: () => {
          this.$data.isLgScreenSize = this.getWindowWidth() >= lgScreenSize;
        },
      };
    },
    methods: {
      getWindowWidth() {
        return Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0);
      }
    },
    mounted() {
      this.$nextTick(() => {
        window.addEventListener("resize", this.$data.resizeHandler);
      });
    },
    beforeDestroy() {
      window.removeEventListener("resize", this.$data.resizeHandler);
    }
  }
</script>
