link dynamic content to a collection

Signed-off-by: Chloe <pinkcloudvnn@gmail.com>
This commit is contained in:
Chloe
2024-07-08 08:52:10 +07:00
parent ebbc8f053c
commit d8e7553918
6 changed files with 25 additions and 23 deletions

View File

@@ -96,8 +96,7 @@ export default async function CategorySearchPage(props: {
}) {
const collectionHandle = props.params.collection;
const manufacturerVariant =
Object.keys(manufactureVariantMap).find((key) => collectionHandle.startsWith(key)) || 'engines';
const [partType, make] = collectionHandle.split('_');
return (
<>
@@ -158,10 +157,11 @@ export default async function CategorySearchPage(props: {
<EngineSizes collectionHandle={collectionHandle} />
</Suspense>
)}
<Suspense>
<Manufacturers variant={manufactureVariantMap[manufacturerVariant]} />
</Suspense>
{!make ? (
<Suspense>
<Manufacturers variant={manufactureVariantMap[partType || 'engines']} />
</Suspense>
) : null}
</>
);
}