Merged in feature/refactor-lang (pull request #387)
feat: SW-238 Avoid prop drilling of lang Approved-by: Michael Zetterberg
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import InitLivePreview from "@/components/Current/LivePreview"
|
||||
import { getLang, setLang } from "@/i18n/serverContext"
|
||||
|
||||
import type { Metadata } from "next"
|
||||
|
||||
@@ -13,8 +14,10 @@ export default function RootLayout({
|
||||
children,
|
||||
params,
|
||||
}: React.PropsWithChildren<LayoutArgs<LangParams>>) {
|
||||
setLang(params.lang)
|
||||
|
||||
return (
|
||||
<html lang={params.lang}>
|
||||
<html lang={getLang()}>
|
||||
<body>
|
||||
<InitLivePreview />
|
||||
{children}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { getLang, setLang } from "@/i18n/serverContext"
|
||||
|
||||
import {
|
||||
ContentTypeParams,
|
||||
LangParams,
|
||||
@@ -9,11 +11,13 @@ export default async function PreviewPage({
|
||||
params,
|
||||
searchParams,
|
||||
}: PageArgs<LangParams & ContentTypeParams & UIDParams, {}>) {
|
||||
setLang(params.lang)
|
||||
|
||||
return (
|
||||
<div>
|
||||
<p>
|
||||
Preview for {params.contentType}:{params.uid} in {params.lang} with
|
||||
params <pre>{JSON.stringify(searchParams, null, 2)}</pre> goes here
|
||||
Preview for {params.contentType}:{params.uid} in {getLang()} with params{" "}
|
||||
<pre>{JSON.stringify(searchParams, null, 2)}</pre> goes here
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user