File tree Expand file tree Collapse file tree 2 files changed +14
-21
lines changed
Expand file tree Collapse file tree 2 files changed +14
-21
lines changed Original file line number Diff line number Diff line change 11<template >
2- <img
3- id =" product-image"
4- class =" h-auto p-8 transition duration-500 ease-in-out transform xl:p-2 md:p-2 lg:p-2 hover:shadow-lg hover:scale-95"
5- :alt =" alt"
6- :src =" displayedImage"
7- />
2+ <img id =" product-image"
3+ class =" h-auto p-8 transition duration-500 ease-in-out transform md:p-0 hover:shadow-lg hover:scale-95" :alt =" alt"
4+ :src =" displayedImage" :width =" width" :height =" height" />
85</template >
96
107<script setup>
118import { computed } from " vue" ;
129
1310const props = defineProps ({
14- alt: { type: String , required: true },
15- src: { type: String , required: true },
11+ alt: { type: String , required: true },
12+ src: { type: String , required: true },
13+ width: { type: String , required: false },
14+ height: { type: String , required: false },
1615});
1716
1817const config = useRuntimeConfig ();
1918
2019const displayedImage = computed (() => {
21- return props .src || config .placeholderImage ;
20+ return props .src || config .placeholderImage ;
2221});
2322 </script >
Original file line number Diff line number Diff line change 1717 query: { id: product.databaseId },
1818 }"
1919 >
20- <img
21- id =" product-image"
22- class =" p-8 border mx-auto w-4/5 border-gray-200 rounded drop-shadow-lg transition duration-500 ease-in-out transform cursor-pointer lg:ml-0 lg:w-full lg:p-2 hover:scale-95"
23- :alt =" product.name"
24- :src =" productImage(product)"
25- />
20+ <ProductImage :alt =" product.name" :src =" productImage(product)" />
21+
2622 <div class =" flex justify-center pt-3" >
2723 <p class =" text-2xl font-bold text-center cursor-pointer" >
2824 {{ product.name }}
6965 query: { id: product.databaseId },
7066 }"
7167 >
72- <img
73- id =" product-image"
74- class =" p-8 border mx-auto w-4/5 border-gray-200 rounded drop-shadow-lg transition duration-500 ease-in-out transform cursor-pointer lg:ml-0 lg:w-full lg:p-2 hover:scale-95"
75- :alt =" product.name"
76- :src =" productImage(product)"
77- />
68+ <ProductImage :alt =" product.name" :src =" productImage(product)" />
69+
7870 <div class =" flex justify-center pt-3" >
7971 <p class =" text-2xl font-bold text-center cursor-pointer" >
8072 {{ product.name }}
111103import FETCH_ALL_PRODUCTS_QUERY from " @/apollo/queries/FETCH_ALL_PRODUCTS_QUERY.gql" ;
112104import GET_PRODUCTS_FROM_CATEGORY_QUERY from " @/apollo/queries/GET_PRODUCTS_FROM_CATEGORY_QUERY.gql" ;
113105
106+ import ProductImage from " @/components/Products/ProductImage.vue" ;
107+
114108import { filteredVariantPrice } from " @/utils/functions" ;
115109
116110const props = defineProps ({
You can’t perform that action at this time.
0 commit comments