Ported more functionality

This commit is contained in:
Henrik Larsson
2023-05-04 09:20:26 +02:00
parent a9ad63d056
commit c68f95e454
27 changed files with 197 additions and 121 deletions

View File

@@ -0,0 +1,15 @@
interface CategoryPageProps {
data: object | any
}
// This is a Client Component. It receives data as props and
// has access to state and effects just like Page components
// in the `pages` directory.
export default function ProductPage({data }: CategoryPageProps) {
console.log(data);
return (
<>Category page</>
)
}

View File

@@ -1,9 +1,13 @@
import DynamicContentManager from 'components/ui/dynamic-content-manager'
import DynamicContentManager from 'components/layout/dynamic-content-manager'
interface HomePageProps {
data: object | any
}
// This is a Client Component. It receives data as props and
// has access to state and effects just like Page components
// in the `pages` directory.
export default function HomePage({ data }: { data: object | any }) {
export default function HomePage({ data }: HomePageProps) {
return (
<DynamicContentManager content={data?.content} />
)

View File

@@ -4,7 +4,9 @@ import getQueryFromSlug from 'helpers/getQueryFromSlug';
import { docQuery } from 'lib/sanity/queries';
import { client } from 'lib/sanity/sanity.client';
import { groq } from 'next-sanity';
import CategoryPage from './category-page';
import HomePage from './home-page';
import ProductPage from './product-page';
import SinglePage from './single-page';
export async function generateStaticParams() {
@@ -57,11 +59,11 @@ export default async function Page({
const data = filterDataToSingleItem(pageData, false)
return (
<div>
<>
<>
{docType === 'home' && <HomePage data={data} />}
{docType === 'product' && <ProductPage data={data} />}
{docType === 'category' && <CategoryPage data={data} />}
{docType === 'page' && <SinglePage data={data} />}
</>
</div>
)
}

View File

@@ -0,0 +1,16 @@
import ProductView from "components/product/product-view";
interface ProductPageProps {
data: object | any
}
// This is a Client Component. It receives data as props and
// has access to state and effects just like Page components
// in the `pages` directory.
export default function ProductPage({data }: ProductPageProps) {
const { product } = data;
return (
<ProductView product={product} relatedProducts={[]} />
)
}

View File

@@ -3,7 +3,7 @@
import dynamic from 'next/dynamic'
const DynamicContentManager = dynamic(
() => import('components/ui/dynamic-content-manager')
() => import('components/layout/dynamic-content-manager')
)
interface SinglePageProps {