diff options
author | Adam Carpenter <atc@53hor.net> | 2020-04-30 20:51:38 -0400 |
---|---|---|
committer | Adam Carpenter <atc@53hor.net> | 2020-04-30 20:51:38 -0400 |
commit | 9119c86ff94fd29086dfd342a616993f20fc5c75 (patch) | |
tree | bcf4a50e72465efd6eaa921d65a30eaf8363f973 /iridescence/src/components | |
parent | 580521ebe3c9d72d756c8e7ab2d53cb6a69443d1 (diff) | |
download | theglassyladies-9119c86ff94fd29086dfd342a616993f20fc5c75.tar.xz theglassyladies-9119c86ff94fd29086dfd342a616993f20fc5c75.zip |
added a search filter for names and descriptions
Diffstat (limited to 'iridescence/src/components')
-rw-r--r-- | iridescence/src/components/InventoryFilter.vue | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/iridescence/src/components/InventoryFilter.vue b/iridescence/src/components/InventoryFilter.vue new file mode 100644 index 0000000..365c1e8 --- /dev/null +++ b/iridescence/src/components/InventoryFilter.vue @@ -0,0 +1,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> |