mirror of
https://github.com/vercel/commerce.git
synced 2025-05-11 04:07:50 +00:00
add default content for PLP page
Signed-off-by: Chloe <pinkcloudvnn@gmail.com>
This commit is contained in:
parent
4738600b4d
commit
631d861324
@ -5,12 +5,12 @@ import DynamicContent from './dynamic-content';
|
||||
|
||||
const Content = async ({ collection }: { collection: Collection }) => {
|
||||
if (!collection.dynamicContent) {
|
||||
return <DefaultContent />;
|
||||
return <DefaultContent collection={collection} />;
|
||||
}
|
||||
|
||||
const content = await getMetaobject({ id: collection.dynamicContent });
|
||||
if (!content) {
|
||||
return <DefaultContent />;
|
||||
return <DefaultContent collection={collection} />;
|
||||
}
|
||||
|
||||
return <DynamicContent content={content} />;
|
||||
|
@ -1,11 +1,27 @@
|
||||
import Tag from 'components/tag';
|
||||
import { getMetaobject } from 'lib/shopify';
|
||||
import { Collection } from 'lib/shopify/types';
|
||||
import { Suspense } from 'react';
|
||||
import Tabs, { TabsPlaceholder } from './tabs';
|
||||
|
||||
const DefaultContent = async () => {
|
||||
const DefaultContent = async ({ collection }: { collection: Collection }) => {
|
||||
let handle = 'default-plp-content';
|
||||
|
||||
if (collection.handle.startsWith('transmissions')) {
|
||||
handle = 'transmissions-plp-content';
|
||||
}
|
||||
if (
|
||||
collection.handle.startsWith('engines') ||
|
||||
collection.handle.startsWith('remanufactured-engines')
|
||||
) {
|
||||
handle = 'engines-plp-content';
|
||||
}
|
||||
if (collection.handle.startsWith('transfer-cases')) {
|
||||
handle = 'transfer-cases-plp-content';
|
||||
}
|
||||
|
||||
const defaultPLPContent = await getMetaobject({
|
||||
handle: { handle: 'default-plp-content', type: 'plp_content' }
|
||||
handle: { handle, type: 'plp_content' }
|
||||
});
|
||||
|
||||
if (!defaultPLPContent) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user