summaryrefslogtreecommitdiff
path: root/iridescence/src/components/InventorySearch.vue
blob: e9da6f6a7b1f79927a384ab02deda01af1358454 (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
41
42
43
44
45
46
47
48
49
50
51
<template>
  <div id="inventorySearch">
    <div class="field is-grouped is-grouped-multiline">
      <div class="control is-expanded">
        <input
          class="input is-primary is-medium"
          type="text"
          placeholder="Find something in particular..."
          v-model.trim="term"
          @input="updateSearch"
          autofocus
        />
      </div>
      <div class="control">
        <div class="select is-primary is-medium">
          <select>
            <option>(Sort by...)</option>
            <option>Age (Oldest to Newest)</option>
            <option>Name</option>
            <option>Price (Low to High)</option>
            <option>Price (High to Low)</option>
          </select>
        </div>
      </div>
    </div>
    <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>