summaryrefslogtreecommitdiff
path: root/iridescence/src/components/InventoryFilter.vue
blob: 365c1e86622865a70336aeef5da6a2779b76da1b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<template>
  <div id="inventoryFilter">
    <section class="section">
      <div class="container">
        <input
          class="input is-primary is-medium"
          type="text"
          placeholder="Find something in particular..."
          v-model.trim="term"
          @input="updateFilter"
          autofocus
        />
      </div>
      <content class="has-text-centered" v-if="noResults">
        <p>We couldn't find anything like that...</p>
      </content>
    </section>
  </div>
</template>

<script>
export default {
  name: "InventoryFilter",
  data() {
    return {
      term: ""
    };
  },
  computed: {
    noResults() {
      return !this.$store.getters.inventory.length;
    }
  },
  methods: {
    updateFilter() {
      this.$store.commit("filterTerm", this.term);
    }
  }
};
</script>