chore: transfer repo
This commit is contained in:
25
components/home/ProductSliderWrapper.tsx
Normal file
25
components/home/ProductSliderWrapper.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import { getCollectionProducts } from 'lib/shopify';
|
||||
import { ProductSliderSection } from './ProductSliderSection';
|
||||
|
||||
/**
|
||||
* Server component responsible for fetching product data
|
||||
*/
|
||||
export async function ProductSliderWrapper() {
|
||||
// Fetch products from Shopify
|
||||
// Try to fetch from a dedicated collection first, and if not available, fetch recent products
|
||||
const products = await getCollectionProducts({
|
||||
collection: 'hidden-homepage-carousel',
|
||||
sortKey: 'CREATED_AT',
|
||||
reverse: true
|
||||
}).catch(() => {
|
||||
return [];
|
||||
});
|
||||
|
||||
// If no products found, don't render anything
|
||||
if (!products || products.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Render the slider section with fetched products
|
||||
return <ProductSliderSection products={products} />;
|
||||
}
|
||||
Reference in New Issue
Block a user