generated from posva/vite-tailwind-starter
-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(Category Card): new action menu with OFF & Share links (#711)
- Loading branch information
Showing
5 changed files
with
97 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<template> | ||
<v-btn :style="style" icon size="small" density="comfortable" variant="text"> | ||
<v-icon>mdi-dots-vertical</v-icon> | ||
<v-menu activator="parent" scroll-strategy="close" transition="slide-y-transition"> | ||
<v-list> | ||
<PriceAddLink v-if="!hidePriceAddLink" class="mr-2" :productCode="category.id" display="list-item" :disabled="!categoryFound" /> | ||
<ShareLink :overrideUrl="getShareLinkUrl" display="list-item" :disabled="!categoryFound" /> | ||
<v-divider /> | ||
<OpenFoodFactsLink facet="category" :value="category.id" display="list-item" :disabled="!categoryFound" /> | ||
</v-list> | ||
</v-menu> | ||
</v-btn> | ||
</template> | ||
|
||
<script> | ||
import { defineAsyncComponent } from 'vue' | ||
export default { | ||
components: { | ||
PriceAddLink: defineAsyncComponent(() => import('../components/PriceAddLink.vue')), | ||
ShareLink: defineAsyncComponent(() => import('../components/ShareLink.vue')), | ||
OpenFoodFactsLink: defineAsyncComponent(() => import('../components/OpenFoodFactsLink.vue')) | ||
}, | ||
props: { | ||
category: { | ||
type: Object, | ||
default: null | ||
}, | ||
source: { | ||
type: String, | ||
default: 'category', | ||
examples: ['category', 'product'] | ||
}, | ||
style: { | ||
type: String, | ||
default: 'position:absolute;bottom:6px;right:0;' | ||
} | ||
}, | ||
computed: { | ||
categoryFound() { | ||
return this.category && !this.category.status | ||
}, | ||
hidePriceAddLink() { | ||
return this.source === 'category' | ||
}, | ||
getShareLinkUrl() { | ||
if (this.source === 'category') { | ||
return `/categories/${this.category.id}` | ||
} | ||
return `/products/${this.category.id}` | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters