Comments (5)
@benjamin-corailfactory I recently have been updating our docs, you might find this guide helpful: https://beta-docs.vendure.io/guides/storefront/listing-products/#listing-products-in-a-collection
from storefront-qwik-starter.
Hi @benjamin-corailfactory, with GraphQL we load products by category and then we loop through them.
Here is the code
In the search variable we stored the GraphQL response
from storefront-qwik-starter.
Hi @gioboa,
Sorry, I've just started react ... And I try your storefront-qwik-starter.
I tried to refactor as component (<CollectionItems collection={collection} />
)
But I have problem with : searchSignal.value ...
Do you have any idea ?
import { component$, useStore } from '@builder.io/qwik';
import { Collection } from '~/generated/graphql';
import ProductCard from '~/components/products/ProductCard';
import { SearchResponse } from '~/generated/graphql';
import {
searchQueryWithCollectionSlug,
} from '~/providers/shop/products/products';
interface IProps {
collection: Collection;
}
export async function useSearchLoader(slug: any) {
return await searchQueryWithCollectionSlug(slug);
}
export default component$(({ collection }: IProps) =>
{
const searchSignal = useSearchLoader(collection.slug);
const state = useStore<{
search: SearchResponse;
}>({
search: searchSignal.value as SearchResponse,
});
return (
<div class="sm:col-span-5 lg:col-span-4">
<div class="grid grid-cols-1 gap-y-10 gap-x-6 sm:grid-cols-2 lg:grid-cols-4 xl:gap-x-8">
{state.search.items.map((item) => (
<ProductCard
key={item.productId}
productAsset={item.productAsset}
productName={item.productName}
slug={item.slug}
priceWithTax={item.priceWithTax}
currencyCode={item.currencyCode}
></ProductCard>
))}
</div>
</div>
);
});
Thanks, and ... sorry (I'm sure it's a silly mistake)
from storefront-qwik-starter.
Have you got a public repo with this project?
from storefront-qwik-starter.
@gioboa No, sorry... I'm not at that stage yet. But the structure is exactly the same. No big changes. Just this file in the components. Thanks
from storefront-qwik-starter.
Related Issues (20)
- Stripe doesn't work ? HOT 3
- 83 point Best practise Lighthouse benchmark HOT 1
- Thanks for sharing the repo HOT 1
- feat: image preview + mobile searchBar + stripe HOT 8
- how to up second storefront HOT 3
- Limit storefront query by adding options: (take:Int) HOT 13
- mobile: add SearchBar
- feat: menu bar to the top left corner HOT 1
- feat: whishlist HOT 1
- Accessing undefined in routes/layouts.tsx HOT 3
- feat: cash on delivery HOT 4
- Checkout with Stripe does not redirect to a confirmation page HOT 22
- Problems with project setup HOT 1
- Feature Request: Promotion Code Implementation HOT 6
- Updated README.md and installation instructions to reflect the use of pnpm install HOT 4
- CSP HOT 1
- Unable to add customFields field to product GraphQL query HOT 1
- Unsure how to add customfields to OrderLine mutation HOT 15
- Issue with Product Display after installing Vendure ElasticSearchPlugin HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from storefront-qwik-starter.