Skip to content

Commit

Permalink
refactor: new ProductPriceAddButton component (#521)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Apr 11, 2024
1 parent e22484e commit 258c0fe
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/components/ProductPriceAddButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<template>
<v-btn
size="small"
color="primary"
prepend-icon="mdi-plus"
:to="'/add/single?code=' + product.code">
{{ $t('ProductDetail.AddPrice') }}
</v-btn>
</template>

<script>
export default {
props: {
product: Object,
required: true
}
}
</script>
3 changes: 2 additions & 1 deletion src/views/ProductDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<v-row class="mt-0" v-if="!productNotFound">
<v-col cols="12">
<v-btn class="mr-2" size="small" color="primary" prepend-icon="mdi-plus" :to="'/add/single?code=' + product.code">{{ $t('ProductDetail.AddPrice') }}</v-btn>
<ProductPriceAddButton class="mr-2" :product="product"></ProductPriceAddButton>
<OpenFoodFactsLink v-if="product.code && product.source" display="button" :source="product.source" facet="product" :value="product.code"></OpenFoodFactsLink>
<ShareButton></ShareButton>
</v-col>
Expand Down Expand Up @@ -63,6 +63,7 @@ import api from '../services/api'
export default {
components: {
'ProductCard': defineAsyncComponent(() => import('../components/ProductCard.vue')),
'ProductPriceAddButton': defineAsyncComponent(() => import('../components/ProductPriceAddButton.vue')),
'FilterMenu': defineAsyncComponent(() => import('../components/FilterMenu.vue')),
'OrderMenu': defineAsyncComponent(() => import('../components/OrderMenu.vue')),
'PriceCard': defineAsyncComponent(() => import('../components/PriceCard.vue')),
Expand Down

0 comments on commit 258c0fe

Please sign in to comment.