mirror of
https://github.com/vercel/commerce.git
synced 2025-07-25 11:11:24 +00:00
feat(poc): carousel and improved sub-collections
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
import clsx from 'clsx';
|
||||
import { Suspense } from 'react';
|
||||
|
||||
import { getStaticCollections } from 'lib/shopware';
|
||||
import { getSubCollections } from 'lib/shopware';
|
||||
import FilterList from './filter';
|
||||
import { transformStaticCollectionToList } from 'lib/shopware/transform';
|
||||
import { transformCollectionToList } from 'lib/shopware/transform';
|
||||
|
||||
async function CollectionList() {
|
||||
const collections = await getStaticCollections();
|
||||
async function CollectionList({ collection }: { collection: string }) {
|
||||
const collections = await getSubCollections(collection);
|
||||
if (collections) {
|
||||
const list = transformStaticCollectionToList(collections);
|
||||
return <FilterList list={list} title="Collections" />;
|
||||
const list = transformCollectionToList(collections);
|
||||
if (list.length > 0) return <FilterList list={list} title="Sub-Collections" />;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ const skeleton = 'mb-3 h-4 w-5/6 animate-pulse rounded';
|
||||
const activeAndTitles = 'bg-gray-800 dark:bg-gray-300';
|
||||
const items = 'bg-gray-400 dark:bg-gray-700';
|
||||
|
||||
export default function Collections() {
|
||||
export default function Collections({ collection }: { collection: string }) {
|
||||
return (
|
||||
<Suspense
|
||||
fallback={
|
||||
@@ -35,7 +35,7 @@ export default function Collections() {
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<CollectionList />
|
||||
<CollectionList collection={collection} />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user