feat(poc): react nextjs initial

This commit is contained in:
Björn Meyer
2023-07-06 10:42:30 +02:00
parent 8c8240956a
commit c9cf57c933
27 changed files with 9010 additions and 658 deletions

View File

@@ -1,11 +1,11 @@
import OpengraphImage from 'components/opengraph-image';
import { getPage } from 'lib/shopify';
import { getPage } from 'lib/shopware';
export const runtime = 'edge';
export default async function Image({ params }: { params: { page: string } }) {
const page = await getPage(params.page);
const title = page.seo?.title || page.title;
const title = page ? page.seo?.title || page.title : '';
return await OpengraphImage({ title });
}

View File

@@ -1,7 +1,7 @@
import type { Metadata } from 'next';
import Prose from 'components/prose';
import { getPage } from 'lib/shopify';
import { getPage } from 'lib/shopware';
import { notFound } from 'next/navigation';
export const runtime = 'edge';
@@ -39,6 +39,10 @@ export default async function Page({ params }: { params: { page: string } }) {
const page = await getPage(params.page);
if (!page) return notFound();
let date = page.createdAt;
if (page.updatedAt !== '') {
date = page.updatedAt;
}
return (
<>
@@ -49,7 +53,7 @@ export default async function Page({ params }: { params: { page: string } }) {
year: 'numeric',
month: 'long',
day: 'numeric'
}).format(new Date(page.updatedAt))}.`}
}).format(new Date(date))}.`}
</p>
</>
);