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.7.2.beta.2 app/assets/lookbook/js/stores/nav.js
lookbook-0.7.2.beta.1 app/assets/lookbook/js/stores/nav.js
lookbook-0.7.2.beta.0 app/assets/lookbook/js/stores/nav.js
lookbook-0.7.1 app/assets/lookbook/js/stores/nav.js
lookbook-0.7.0 app/assets/lookbook/js/stores/nav.js
lookbook-0.6.1 app/assets/lookbook/js/stores/nav.js
lookbook-0.6.0 app/assets/lookbook/js/stores/nav.js
lookbook-0.5.2 app/assets/lookbook/js/stores/nav.js
lookbook-0.5.1 app/assets/lookbook/js/stores/nav.js
lookbook-0.5.0 app/assets/lookbook/js/stores/nav.js
lookbook-0.5.0.beta.2 app/assets/lookbook/js/stores/nav.js
lookbook-0.5.0.beta.1 app/assets/lookbook/js/stores/nav.js
lookbook-0.5.0.beta.0 app/assets/lookbook/js/stores/nav.js
lookbook-0.4.8 app/assets/lookbook/js/stores/nav.js
lookbook-0.4.7 app/assets/lookbook/js/stores/nav.js