diff --git a/apps/web/app/(marketing)/blog/page.tsx b/apps/web/app/(marketing)/blog/page.tsx index 18926d722..f8fff5238 100644 --- a/apps/web/app/(marketing)/blog/page.tsx +++ b/apps/web/app/(marketing)/blog/page.tsx @@ -1,4 +1,4 @@ -import { unstable_cache as cache } from 'next/dist/server/web/spec-extension/unstable-cache'; +import { cache } from 'react'; import { createCmsClient } from '@kit/cms'; import { If } from '@kit/ui/if'; diff --git a/apps/web/app/(marketing)/docs/_lib/server/docs.loader.ts b/apps/web/app/(marketing)/docs/_lib/server/docs.loader.ts new file mode 100644 index 000000000..6d4c713a6 --- /dev/null +++ b/apps/web/app/(marketing)/docs/_lib/server/docs.loader.ts @@ -0,0 +1,14 @@ +import { cache } from 'react'; + +import { createCmsClient } from '@kit/cms'; + +export const getDocs = cache(async (language: string | undefined) => { + const cms = await createCmsClient(); + + const { items: pages } = await cms.getContentItems({ + collection: 'documentation', + language, + }); + + return pages; +}); diff --git a/apps/web/app/(marketing)/docs/layout.tsx b/apps/web/app/(marketing)/docs/layout.tsx index 8fee41ca7..6b9e8e2b5 100644 --- a/apps/web/app/(marketing)/docs/layout.tsx +++ b/apps/web/app/(marketing)/docs/layout.tsx @@ -1,16 +1,12 @@ import { Cms, createCmsClient } from '@kit/cms'; import { DocsNavigation } from '~/(marketing)/docs/_components/docs-navigation'; +import { getDocs } from '~/(marketing)/docs/_lib/server/docs.loader'; import { createI18nServerInstance } from '~/lib/i18n/i18n.server'; async function DocsLayout({ children }: React.PropsWithChildren) { - const cms = await createCmsClient(); const { resolvedLanguage } = await createI18nServerInstance(); - - const { items: pages } = await cms.getContentItems({ - collection: 'documentation', - language: resolvedLanguage, - }); + const pages = await getDocs(resolvedLanguage); return (
diff --git a/apps/web/app/(marketing)/docs/page.tsx b/apps/web/app/(marketing)/docs/page.tsx index 6d571bb85..fe04467e9 100644 --- a/apps/web/app/(marketing)/docs/page.tsx +++ b/apps/web/app/(marketing)/docs/page.tsx @@ -5,6 +5,7 @@ import { PageBody } from '@kit/ui/page'; import { SitePageHeader } from '~/(marketing)/_components/site-page-header'; import { DocsCards } from '~/(marketing)/docs/_components/docs-cards'; +import { getDocs } from '~/(marketing)/docs/_lib/server/docs.loader'; import { createI18nServerInstance } from '~/lib/i18n/i18n.server'; import { withI18n } from '~/lib/i18n/with-i18n'; @@ -16,18 +17,9 @@ export const generateMetadata = async () => { }; }; -const getContentItems = cache(async (resolvedLanguage: string | undefined) => { - const client = await createCmsClient(); - - return client.getContentItems({ - collection: 'documentation', - language: resolvedLanguage, - }); -}); - async function DocsPage() { const { t, resolvedLanguage } = await createI18nServerInstance(); - const { items } = await getContentItems(resolvedLanguage); + const items = await getDocs(resolvedLanguage); // Filter out any docs that have a parentId, as these are children of other docs const cards = items.filter((item) => !item.parentId); diff --git a/packages/ui/package.json b/packages/ui/package.json index 03d8a18ef..969a1d155 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -109,6 +109,7 @@ "./radio-group": "./src/shadcn/radio-group.tsx", "./separator": "./src/shadcn/separator.tsx", "./input-otp": "./src/shadcn/input-otp.tsx", + "./textarea": "./src/shadcn/textarea.tsx", "./utils": "./src/utils/index.ts", "./if": "./src/makerkit/if.tsx", "./trans": "./src/makerkit/trans.tsx", diff --git a/packages/ui/src/makerkit/page.tsx b/packages/ui/src/makerkit/page.tsx index 4f798f713..61cfaf598 100644 --- a/packages/ui/src/makerkit/page.tsx +++ b/packages/ui/src/makerkit/page.tsx @@ -39,37 +39,41 @@ export function PageHeader({ description, mobileNavigation, }: React.PropsWithChildren<{ - title: string | React.ReactNode; + title?: string | React.ReactNode; description?: string | React.ReactNode; mobileNavigation?: React.ReactNode; }>) { return ( -
-
-
{mobileNavigation}
- -

+ {title ? ( +
- {title} -

+
+ {mobileNavigation} +
-

- - {description} - -

-
+ {title} + + +

+ + {description} + +

+
+ ) : null} {children}