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(theme): fix add to wishlist button on category listing view for mobile devices #554

Merged
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
26 changes: 14 additions & 12 deletions packages/theme/pages/Category.vue
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@
:score-rating="productGetters.getAverageRating(product)"
:reviews-count="productGetters.getTotalReviews(product)"
:is-in-wishlist="isInWishlist({product})"
:is-in-wishlist-icon="isAuthenticated ? 'heart_fill' : ''"
:wishlist-icon="isAuthenticated ? 'heart' : ''"
:is-in-wishlist-icon="isAuthenticated ? '' : ''"
:wishlist-icon="isAuthenticated ? '' : ''"
:link="
localePath(
`/p/${productGetters.getProductSku(
Expand All @@ -207,6 +207,7 @@
)
"
@click:add-to-cart="addItemToCart({ product, quantity: 1 })"
@click:wishlist="addItemToWishlist(product)"
>
<template #image="imageSlotProps">
<SfLink
Expand Down Expand Up @@ -252,8 +253,7 @@
</template>
<template #actions>
<SfButton
class="sf-button--text desktop-only"
style="margin: 0 0 1rem auto; display: block"
class="sf-button--text products__product-card-horizontal__add-to-wishlist"
@click="addItemToWishlist(product)"
>
{{ isInWishlist({product}) ? $t('Remove from Wishlist') : $t('Save for later') }}
Expand Down Expand Up @@ -438,7 +438,6 @@ import cacheControl from '~/helpers/cacheControl';
import { useAddToCart } from '~/helpers/cart/addToCart';
import CategorySidebarMenu from '~/components/Category/CategorySidebarMenu';


// TODO(addToCart qty, horizontal): https://github.com/vuestorefront/storefront-ui/issues/1606
export default defineComponent({
name: 'CategoryPage',
Expand Down Expand Up @@ -646,16 +645,12 @@ export default defineComponent({

const tags = [{ prefix: CacheTagPrefix.View, value: 'category' }];
// eslint-disable-next-line no-underscore-dangle
const productTags = products.value.map((product) => {
return { prefix: CacheTagPrefix.Product, value: product.uid };
});
const productTags = products.value.map((product) => ({ prefix: CacheTagPrefix.Product, value: product.uid }));

const categoriesTags = categoryTree.value.items.map((category) => {
return { prefix: CacheTagPrefix.Category, value: category.slug };
});
const categoriesTags = categoryTree.value.items.map((category) => ({ prefix: CacheTagPrefix.Category, value: category.slug }));

// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
addTags(tags.concat(productTags, categoriesTags));
addTags([...tags, ...productTags, ...categoriesTags]);
});

const { getMagentoImage, imageSizes } = useImage();
Expand Down Expand Up @@ -927,6 +922,13 @@ export default defineComponent({
--image-height: 7.0625rem;
}
}

&__add-to-wishlist {
@include for-mobile {
margin: 1rem auto;
}
display: block
}
}

&__slide-enter {
Expand Down