Sha256: 0baca9f7cad9cc87c4370a06b6ff1c62a7fb0fe45d1914bf3b90aae5392b074d

Contents?: true

Size: 906 Bytes

Versions: 5

Compression:

Stored size: 906 Bytes

Contents

import tippy from "@libs/tippy";
import { CocoComponent } from "@js/coco";

export default CocoComponent("appSidebarNavItem", () => {
  return {
    menu: null,

    init() {
      if (this.$refs.menu) {
        this.menu = tippy(this.$el, {
          theme: "coco-naked-dropdown",
          placement: this.menuPlacement,
          arrow: false,
          offset: [0, 0],
          trigger: "click",
          interactive: true,
          maxWidth: null,
          content: () => {
            return this.$refs.menu.innerHTML;
          },
        });
      }

      this.$watch("mobileLayout", () => {
        this.onOrientationChange();
      });
    },

    onOrientationChange() {
      if (this.menu) {
        this.menu.setProps({
          placement: this.menuPlacement,
        });
      }
    },

    get menuPlacement() {
      return this.mobileLayout ? "top" : "right-start";
    },
  };
});

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
coveragebook_components-0.8.1 app/components/coco/app/blocks/sidebar_nav_item/sidebar_nav_item.js
coveragebook_components-0.8.0 app/components/coco/app/blocks/sidebar_nav_item/sidebar_nav_item.js
coveragebook_components-0.8.0.beta.3 app/components/coco/app/blocks/sidebar_nav_item/sidebar_nav_item.js
coveragebook_components-0.8.0.beta.2 app/components/coco/app/blocks/sidebar_nav_item/sidebar_nav_item.js
coveragebook_components-0.8.0.beta.1 app/components/coco/app/blocks/sidebar_nav_item/sidebar_nav_item.js