1
0
mirror of https://github.com/kihashi/stardew_community_checklist.git synced 2025-10-19 08:03:17 +00:00

Add bundle button

This commit is contained in:
John Cleaver 2018-03-05 21:16:19 -05:00
parent bfb8a9701a
commit cd9ae09cd4

View File

@ -1,11 +1,49 @@
<template> <template>
<a class="button is-rounded is-fullwidth" :class="ItemInBundle ? 'is-success' : 'is-danger'"
@click="ToggleItemInBundle">
<span class="icon">
<font-awesome-icon :icon="ItemInBundle ? InBundleIcon : NotInBundleIcon"/>
</span>
<span>{{bundleItem.bundle.name}}</span>
</a>
</template> </template>
<script> <script>
export default { import FontAwesomeIcon from '@fortawesome/vue-fontawesome'
name: "bundle-button" import faCheckSquare from '@fortawesome/fontawesome-free-regular/faCheckSquare'
import faSquare from '@fortawesome/fontawesome-free-regular/faSquare'
export default {
name: 'bundle-button',
components: {
'font-awesome-icon': FontAwesomeIcon
},
props: {
bundleItem: {
type: Object,
required: true
} }
},
computed: {
ItemInBundle: function () {
return this.$store.getters.IsBundleItemRedeemed(this.bundleItem)
},
InBundleIcon () {
return faCheckSquare
},
NotInBundleIcon () {
return faSquare
}
},
methods: {
ToggleItemInBundle () {
if (!this.ItemInBundle) {
this.$store.commit('RedeemItem', this.bundleItem)
} else {
this.$store.commit('UndoRedeemItem', this.bundleItem)
}
}
}
}
</script> </script>
<style scoped> <style scoped>