Sha256: 86ba7c446262509df0930c45e5c16e9dbe4c2acbdf77a7c2ccf92458e8c6708a

Contents?: true

Size: 923 Bytes

Versions: 2

Compression:

Stored size: 923 Bytes

Contents

import { CocoComponent } from "@assets/js/coco/component";
import { navigateTo } from "@helpers/location";

export default CocoComponent("appLayout", (opts) => {
  return {
    banner: false,

    init() {
      this.banner = opts.banner;
      this.setAppHeight();
    },

    handleNavigation(event) {
      const url = event.detail.url;
      if (url) {
        delete event.detail.url;
        navigateTo(url, event.detail);
      }
    },

    // Update the value of the `--app-height` css variable
    // when the viewport size changes. To help work around the
    // issues when using 100vh on mobile safari (https://medium.com/quick-code/100vh-problem-with-ios-safari-92ab23c852a8)
    setAppHeight() {
      document.documentElement.style.setProperty(
        "--app-height",
        `${window.innerHeight}px`
      );
    },

    hideBanner() {
      this.banner = false;
      this.$el.remove();
    },
  };
});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
coveragebook_components-0.16.0 app/components/coco/app/application_layout/application_layout.js
coveragebook_components-0.15.0 app/components/coco/app/application_layout/application_layout.js