summaryrefslogtreecommitdiff
path: root/iridescence/src/components/InventorySearch.vue
blob: fbcaabb283844e1a2ecfa9a38ebbe8f68fda8622 (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
<template>
  <div id="inventorySearch">
    <input
      class="input is-primary is-medium"
      type="text"
      placeholder="Find something in particular..."
      v-model.trim="term"
      @input="updateSearch"
      autofocus
    />
    <content class="has-text-centered" v-if="noResults">
      <p>We couldn't find anything like that...</p>
    </content>
  </div>
</template>

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