Sha256: a33a5407a1d79af01770bf6060bad667bd568ef7a5d61c32bb01fd2e6efaffef

Contents?: true

Size: 676 Bytes

Versions: 25

Compression:

Stored size: 676 Bytes

Contents

export default function nav(filterable = true) {
  return {
    empty: false,
    init() {
      if (filterable) {
        this.$watch("$store.filter.text", () => this.filter());
        this.$nextTick(() => {
          this.filter();
        });
      }
    },
    filter() {
      this.empty = true;
      this.getChildren().forEach((child) => {
        const data = Alpine.$data(child);
        data.filter(this.$store.filter.text);
        if (!data.hidden) {
          this.empty = false;
        }
      });
    },
    getChildren() {
      return this.$refs.items
        ? Array.from(this.$refs.items.querySelectorAll(":scope > li > div"))
        : [];
    },
  };
}

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
lookbook-0.9.8 app/assets/lookbook/js/components/nav.js
lookbook-0.9.7 app/assets/lookbook/js/components/nav.js
lookbook-0.9.6 app/assets/lookbook/js/components/nav.js
lookbook-0.9.5 app/assets/lookbook/js/components/nav.js
lookbook-0.9.4 app/assets/lookbook/js/components/nav.js
lookbook-0.9.3 app/assets/lookbook/js/components/nav.js
lookbook-0.9.2 app/assets/lookbook/js/components/nav.js
lookbook-0.9.1 app/assets/lookbook/js/components/nav.js
lookbook-0.9.0 app/assets/lookbook/js/components/nav.js
lookbook-0.8.3 app/assets/lookbook/js/components/nav.js
lookbook-0.8.2 app/assets/lookbook/js/components/nav.js
lookbook-0.8.1 app/assets/lookbook/js/components/nav.js
lookbook-0.8.0 app/assets/lookbook/js/components/nav.js
lookbook-0.8.0.beta.0 app/assets/lookbook/js/components/nav.js
lookbook-0.7.4 app/assets/lookbook/js/components/nav.js
lookbook-0.7.3 app/assets/lookbook/js/components/nav.js
lookbook-0.7.2 app/assets/lookbook/js/components/nav.js
lookbook-0.7.2.beta.5 app/assets/lookbook/js/components/nav.js
lookbook-0.7.2.beta.4 app/assets/lookbook/js/components/nav.js
lookbook-0.7.2.beta.3 app/assets/lookbook/js/components/nav.js