1
0
mirror of https://github.com/vercel/commerce.git synced 2025-09-03 14:30:15 +00:00
Files
commerce/components/plp/content.tsx
2024-07-08 08:52:10 +07:00

25 lines
626 B
TypeScript

import { getCollection, getMetaobject } from 'lib/shopify';
import DefaultContent from './default-content';
import DynamicContent from './dynamic-content';
const Content = async ({ collection }: { collection: string }) => {
const collectionData = await getCollection({ handle: collection });
if (!collectionData) {
return null;
}
if (!collectionData.dynamicContent) {
return <DefaultContent />;
}
const content = await getMetaobject({ id: collectionData.dynamicContent });
if (!content) {
return <DefaultContent />;
}
return <DynamicContent content={content} />;
};
export default Content;