Files
myeasycms-v2/apps/web/app/(marketing)/docs/[...slug]/page.tsx
giancarlo e7f2660032 Update UI design across multiple pages and components
Several changes have been made to improve the user interface and enhance the user experience. This includes redesigning Auth buttons, modifying website layouts and routing, tweaking heading and text sizes for clarity, and revamping the marketing, documentation, and pricing pages. These changes collectively contribute to a cleaner, more concise and navigable interface.
2024-04-09 13:35:12 +08:00

76 lines
1.6 KiB
TypeScript

import { cache } from 'react';
import { notFound } from 'next/navigation';
import { ContentRenderer, createCmsClient } from '@kit/cms';
import { If } from '@kit/ui/if';
import { SitePageHeader } from '~/(marketing)/_components/site-page-header';
import { DocsCards } from '~/(marketing)/docs/_components/docs-cards';
import { withI18n } from '~/lib/i18n/with-i18n';
import styles from '../../blog/_components/html-renderer.module.css';
const getPageBySlug = cache(async (slug: string) => {
const client = await createCmsClient();
return client.getContentItemById(slug);
});
interface PageParams {
params: {
slug: string[];
};
}
export const generateMetadata = async ({ params }: PageParams) => {
const page = await getPageBySlug(params.slug.join('/'));
if (!page) {
notFound();
}
const { title, description } = page;
return {
title,
description,
};
};
async function DocumentationPage({ params }: PageParams) {
const page = await getPageBySlug(params.slug.join('/'));
if (!page) {
notFound();
}
const description = page?.description ?? '';
return (
<div>
<SitePageHeader
title={page.title}
subtitle={description}
className={'items-start'}
/>
<div
className={
'container relative mx-auto flex max-w-4xl grow flex-col space-y-4 py-6'
}
>
<article className={styles.HTML}>
<ContentRenderer content={page.content} />
</article>
<If condition={page.children}>
<DocsCards cards={page.children ?? []} />
</If>
</div>
</div>
);
}
export default withI18n(DocumentationPage);