Sha256: ca41296a98c9ee7af3210be78d303096f15ad00160e5a732fcd16037aba43c24

Contents?: true

Size: 502 Bytes

Versions: 35

Compression:

Stored size: 502 Bytes

Contents

export default function createNavStore(Alpine) {
  return {
    open: Alpine.$persist([]).as("nav-open"),
    active: Alpine.$persist(null).as("nav-active"),
    isOpen(id) {
      return this.open.includes(id);
    },
    setOpen(id) {
      this.open.push(id);
    },
    setClosed(id) {
      const index = this.open.indexOf(id);
      if (index > -1) {
        this.open.splice(index, 1);
      }
    },
    toggle(id) {
      this.isOpen(id) ? this.setClosed(id) : this.setOpen(id);
    },
  };
}

Version data entries

35 entries across 35 versions & 1 rubygems

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