Next.js Supabase V3 (#463)
Version 3 of the kit: - Radix UI replaced with Base UI (using the Shadcn UI patterns) - next-intl replaces react-i18next - enhanceAction deprecated; usage moved to next-safe-action - main layout now wrapped with [locale] path segment - Teams only mode - Layout updates - Zod v4 - Next.js 16.2 - Typescript 6 - All other dependencies updated - Removed deprecated Edge CSRF - Dynamic Github Action runner
This commit is contained in:
committed by
GitHub
parent
4912e402a3
commit
7ebff31475
49
apps/web/app/[locale]/docs/layout.tsx
Normal file
49
apps/web/app/[locale]/docs/layout.tsx
Normal file
@@ -0,0 +1,49 @@
|
||||
import { getLocale } from 'next-intl/server';
|
||||
|
||||
import { SidebarInset, SidebarProvider } from '@kit/ui/sidebar';
|
||||
|
||||
import { DocsHeader } from './_components/docs-header';
|
||||
// local imports
|
||||
import { DocsNavigation } from './_components/docs-navigation';
|
||||
import { getDocs } from './_lib/server/docs.loader';
|
||||
import { buildDocumentationTree } from './_lib/utils';
|
||||
|
||||
type DocsLayoutProps = React.PropsWithChildren<{
|
||||
params: Promise<{ locale?: string }>;
|
||||
}>;
|
||||
|
||||
async function DocsLayout({ children, params }: DocsLayoutProps) {
|
||||
let { locale } = await params;
|
||||
|
||||
if (!locale) {
|
||||
locale = await getLocale();
|
||||
}
|
||||
|
||||
return (
|
||||
<SidebarProvider
|
||||
defaultOpen={true}
|
||||
style={
|
||||
{
|
||||
'--sidebar-width': '300px',
|
||||
} as React.CSSProperties
|
||||
}
|
||||
>
|
||||
<DocsSidebar locale={locale} />
|
||||
|
||||
<SidebarInset className="h-screen overflow-y-auto overscroll-y-none">
|
||||
<DocsHeader />
|
||||
|
||||
{children}
|
||||
</SidebarInset>
|
||||
</SidebarProvider>
|
||||
);
|
||||
}
|
||||
|
||||
async function DocsSidebar({ locale }: { locale: string }) {
|
||||
const pages = await getDocs(locale);
|
||||
const tree = buildDocumentationTree(pages);
|
||||
|
||||
return <DocsNavigation pages={tree} />;
|
||||
}
|
||||
|
||||
export default DocsLayout;
|
||||
Reference in New Issue
Block a user