Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: mobile category add to cart button is missin on mobile view #1171

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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