41 lines
1007 B
TypeScript
41 lines
1007 B
TypeScript
import { Metadata } from 'next';
|
|
|
|
import { getRegion, listCollections } from '~/medusa/lib/data';
|
|
import FeaturedProducts from '~/medusa/modules/home/components/featured-products';
|
|
import Hero from '~/medusa/modules/home/components/hero';
|
|
|
|
export const metadata: Metadata = {
|
|
title: 'Medusa Next.js Starter Template',
|
|
description:
|
|
'A performant frontend ecommerce starter template with Next.js 15 and Medusa.',
|
|
};
|
|
|
|
export default async function Home(props: {
|
|
params: Promise<{ countryCode: string }>;
|
|
}) {
|
|
const params = await props.params;
|
|
|
|
const { countryCode } = params;
|
|
|
|
const region = await getRegion(countryCode);
|
|
|
|
const { collections } = await listCollections({
|
|
fields: 'id, handle, title',
|
|
});
|
|
|
|
if (!collections || !region) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<Hero />
|
|
<div className="py-12">
|
|
<ul className="flex flex-col gap-x-6">
|
|
<FeaturedProducts collections={collections} region={region} />
|
|
</ul>
|
|
</div>
|
|
</>
|
|
);
|
|
}
|