Skip to content

Commit

Permalink
fix: mobile category add to cart button is missin on mobile view
Browse files Browse the repository at this point in the history
- make add to cart button always visible on the mobile view
  • Loading branch information
bartoszherba committed Jun 27, 2022
1 parent c56d15d commit c8a60d5
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
data-testid="product-card"
:image-height="imageSize.height"
:image-width="imageSize.width"
show-add-to-cart-button
:show-add-to-cart-button="true"
@click:wishlist="$emit('click:wishlist', product)"
@click:add-to-cart="$emit('click:add-to-cart', { product, quantity: 1 })"
>
Expand Down Expand Up @@ -102,4 +102,14 @@ export default defineComponent({
}
}
::v-deep .sf-product-card__add-button {
@include for-mobile {
opacity: 1;
display: flex;
z-index: 10;
bottom: 1rem;
right: 0;
}
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,14 @@ export default defineComponent({
}
}
::v-deep .sf-product-card__add-button {
@include for-mobile {
opacity: 1;
display: flex;
z-index: 10;
bottom: 1rem;
right: 0;
}
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<script lang="ts">
import { defineComponent, PropType } from '@nuxtjs/composition-api';
import { SfPrice } from '@storefront-ui/vue';
import type { ProductWithCommondProductCardProps } from '~/modules/catalog/category/components/views/useProductsWithCommonCardProps';
import type { ProductWithCommonProductCardProps } from '~/modules/catalog/category/components/views/useProductsWithCommonCardProps';
export default defineComponent({
name: 'CategoryProductPrice',
Expand All @@ -61,7 +61,7 @@ export default defineComponent({
},
props: {
product: {
type: Object as PropType<ProductWithCommondProductCardProps>,
type: Object as PropType<ProductWithCommonProductCardProps>,
required: true,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ interface ProductCommonCardProps {
scoreRating: number,
}

export type ProductWithCommondProductCardProps = Product & { commonProps: ProductCommonCardProps };
export type ProductWithCommonProductCardProps = Product & { commonProps: ProductCommonCardProps };

export const useProductsWithCommonProductCardProps = (products: Ref<Product[]>) => {
const { getMagentoImage } = useImage();
Expand All @@ -47,7 +47,7 @@ export const useProductsWithCommonProductCardProps = (products: Ref<Product[]>)
* To avoid passing tens of props to both components two times,
* instead the below object is passed to them using `v-bind="product.commonProps"`
*/
const productsWithCommonProductCardProps = computed<ProductWithCommondProductCardProps[]>(
const productsWithCommonProductCardProps = computed<ProductWithCommonProductCardProps[]>(
() => products.value.map((product, index) => {
const imageProps = {
image: getMagentoImage(getProductThumbnailImage(product)),
Expand Down

0 comments on commit c8a60d5

Please sign in to comment.