2021-01-18 07:22:54 +00:00
|
|
|
<template>
|
2021-05-05 22:08:13 +00:00
|
|
|
<div>
|
|
|
|
<v-chip label color="accent custom-transparent" class="ma-1" v-for="(time, index) in allTimes" :key="index">
|
|
|
|
<v-icon left>
|
|
|
|
mdi-clock-outline
|
|
|
|
</v-icon>
|
|
|
|
{{ time.name }} |
|
|
|
|
{{ time.value }}
|
|
|
|
</v-chip>
|
|
|
|
</div>
|
2021-01-18 07:22:54 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
prepTime: String,
|
|
|
|
totalTime: String,
|
|
|
|
performTime: String,
|
|
|
|
},
|
|
|
|
computed: {
|
2021-04-22 05:52:12 +00:00
|
|
|
showCards() {
|
2021-05-02 04:46:02 +00:00
|
|
|
return [this.prepTime, this.totalTime, this.performTime].some(x => !this.isEmpty(x));
|
2021-01-18 07:22:54 +00:00
|
|
|
},
|
2021-04-22 05:52:12 +00:00
|
|
|
allTimes() {
|
2021-05-02 04:46:02 +00:00
|
|
|
return [this.validateTotalTime, this.validatePrepTime, this.validatePerformTime].filter(x => x !== null);
|
2021-01-18 07:22:54 +00:00
|
|
|
},
|
2021-04-22 05:52:12 +00:00
|
|
|
validateTotalTime() {
|
2021-05-02 04:46:02 +00:00
|
|
|
return !this.isEmpty(this.totalTime) ? { name: this.$t("recipe.total-time"), value: this.totalTime } : null;
|
2021-04-22 05:52:12 +00:00
|
|
|
},
|
|
|
|
validatePrepTime() {
|
2021-05-02 04:46:02 +00:00
|
|
|
return !this.isEmpty(this.prepTime) ? { name: this.$t("recipe.prep-time"), value: this.prepTime } : null;
|
2021-04-22 05:52:12 +00:00
|
|
|
},
|
|
|
|
validatePerformTime() {
|
2021-05-02 04:46:02 +00:00
|
|
|
return !this.isEmpty(this.performTime) ? { name: this.$t("recipe.perform-time"), value: this.performTime } : null;
|
2021-04-22 05:52:12 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
isEmpty(str) {
|
|
|
|
return !str || str.length === 0;
|
2021-01-18 07:22:54 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
2021-04-22 05:52:12 +00:00
|
|
|
.time-card-flex {
|
|
|
|
width: fit-content;
|
|
|
|
}
|
2021-01-18 07:22:54 +00:00
|
|
|
.custom-transparent {
|
|
|
|
opacity: 0.7;
|
|
|
|
}
|
2021-05-02 04:46:02 +00:00
|
|
|
</style>
|