2017-06-23 11:24:10 +00:00
|
|
|
<template lang="pug">
|
2017-09-01 13:15:54 +00:00
|
|
|
div
|
|
|
|
|
.item-wrapper(@click="click()", :id="itemId")
|
2018-02-19 17:55:16 +00:00
|
|
|
.item.pet-slot(
|
2017-07-10 08:07:23 +00:00
|
|
|
:class="{'item-empty': emptyItem, 'highlight': highlightBorder}",
|
2017-06-23 11:24:10 +00:00
|
|
|
)
|
|
|
|
|
slot(name="itemBadge", :item="item")
|
|
|
|
|
span.item-content(:class="itemContentClass")
|
2017-07-01 15:46:24 +00:00
|
|
|
span.pet-progress-background(v-if="item.isAllowedToFeed() && progress > 0")
|
2017-06-23 11:24:10 +00:00
|
|
|
div.pet-progress-bar(v-bind:style="{width: 100 * progress/50 + '%' }")
|
|
|
|
|
span.item-label(v-if="label") {{ label }}
|
2017-09-01 13:15:54 +00:00
|
|
|
|
|
|
|
|
b-popover(
|
|
|
|
|
:target="itemId",
|
2017-09-19 20:45:28 +00:00
|
|
|
:triggers="showPopover ? 'hover' : ''",
|
2017-09-01 13:15:54 +00:00
|
|
|
:placement="popoverPosition",
|
|
|
|
|
)
|
|
|
|
|
slot(name="popoverContent", :item="item")
|
2017-06-23 11:24:10 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
.pet-progress-background {
|
|
|
|
|
width: 62px;
|
|
|
|
|
height: 4px;
|
|
|
|
|
background-color: #e1e0e3;
|
|
|
|
|
position: absolute;
|
|
|
|
|
bottom: 4px;
|
|
|
|
|
left: calc((100% - 62px) / 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.pet-progress-bar {
|
|
|
|
|
height: 4px;
|
|
|
|
|
background-color: #24cc8f;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
<script>
|
2017-09-01 13:15:54 +00:00
|
|
|
import uuid from 'uuid';
|
2017-06-23 11:24:10 +00:00
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
props: {
|
|
|
|
|
item: {
|
|
|
|
|
type: Object,
|
|
|
|
|
},
|
|
|
|
|
itemContentClass: {
|
|
|
|
|
type: String,
|
|
|
|
|
},
|
|
|
|
|
label: {
|
|
|
|
|
type: String,
|
|
|
|
|
},
|
|
|
|
|
progress: {
|
|
|
|
|
type: Number,
|
|
|
|
|
default: -1,
|
|
|
|
|
},
|
|
|
|
|
emptyItem: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
2017-07-10 08:07:23 +00:00
|
|
|
highlightBorder: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
2017-06-23 11:24:10 +00:00
|
|
|
popoverPosition: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: 'bottom',
|
|
|
|
|
},
|
|
|
|
|
showPopover: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
2017-09-01 13:15:54 +00:00
|
|
|
data () {
|
|
|
|
|
return Object.freeze({
|
|
|
|
|
itemId: uuid.v4(),
|
|
|
|
|
});
|
|
|
|
|
},
|
2017-06-23 11:24:10 +00:00
|
|
|
methods: {
|
2017-07-10 08:07:23 +00:00
|
|
|
click () {
|
|
|
|
|
this.$emit('click', {});
|
2017-06-23 11:24:10 +00:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
</script>
|