This repository has been archived by the owner on Sep 18, 2024. It is now read-only.
forked from HHS/simpler-grants-gov
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
18 changed files
with
76 additions
and
403 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { NextIntlClientProvider } from "next-intl"; | ||
import { getMessages, unstable_setRequestLocale } from "next-intl/server"; | ||
|
||
import { GoogleAnalytics } from "@next/third-parties/google"; | ||
import { PUBLIC_ENV } from "src/constants/environments"; | ||
|
||
import Layout from "src/components/Layout"; | ||
|
||
/** | ||
* Root layout component, wraps all pages. | ||
* @see https://nextjs.org/docs/app/api-reference/file-conventions/layout | ||
*/ | ||
import { Metadata } from "next"; | ||
|
||
export const metadata: Metadata = { | ||
icons: [`${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/img/favicon.ico`], | ||
}; | ||
|
||
interface Props { | ||
children: React.ReactNode; | ||
params: { | ||
locale: string; | ||
}; | ||
} | ||
|
||
const locales = ["en", "es"]; | ||
|
||
export function generateStaticParams() { | ||
return locales.map((locale) => ({ locale })); | ||
} | ||
|
||
export default async function LocaleLayout({ children, params }: Props) { | ||
const { locale } = params; | ||
|
||
// Enable static rendering | ||
unstable_setRequestLocale(locale); | ||
|
||
// Providing all messages to the client | ||
// side is the easiest way to get started | ||
const messages = await getMessages(); | ||
|
||
return ( | ||
<html lang={locale}> | ||
<head> | ||
<GoogleAnalytics gaId={PUBLIC_ENV.GOOGLE_ANALYTICS_ID} /> | ||
</head> | ||
<body> | ||
<NextIntlClientProvider messages={messages}> | ||
<Layout locale={locale}>{children}</Layout> | ||
</NextIntlClientProvider> | ||
</body> | ||
</html> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,10 @@ | ||
import "src/styles/styles.scss"; | ||
import { GoogleAnalytics } from "@next/third-parties/google"; | ||
import { PUBLIC_ENV } from "src/constants/environments"; | ||
import { ReactNode } from "react"; | ||
|
||
import Layout from "src/components/Layout"; | ||
import { unstable_setRequestLocale } from "next-intl/server"; | ||
/** | ||
* Root layout component, wraps all pages. | ||
* @see https://nextjs.org/docs/app/api-reference/file-conventions/layout | ||
*/ | ||
import { Metadata } from "next"; | ||
|
||
export const metadata: Metadata = { | ||
icons: [`${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/img/favicon.ico`], | ||
type Props = { | ||
children: ReactNode; | ||
}; | ||
|
||
interface LayoutProps { | ||
children: React.ReactNode; | ||
params: { | ||
locale: string; | ||
}; | ||
} | ||
|
||
export default function RootLayout({ children, params }: LayoutProps) { | ||
// Hardcoded until the [locale] routing is enabled. | ||
const locale = params.locale ? params.locale : "en"; | ||
// TODO: Remove when https://github.com/amannn/next-intl/issues/663 lands. | ||
unstable_setRequestLocale(locale); | ||
|
||
return ( | ||
<html lang={locale}> | ||
<head> | ||
<GoogleAnalytics gaId={PUBLIC_ENV.GOOGLE_ANALYTICS_ID} /> | ||
</head> | ||
<body> | ||
{/* Separate layout component for the inner-body UI elements since Storybook | ||
and tests trip over the fact that this file renders an <html> tag */} | ||
|
||
{/* TODO: Add locale="english" prop when ready for i18n */} | ||
<Layout locale={locale}>{children}</Layout> | ||
</body> | ||
</html> | ||
); | ||
export default function RootLayout({ children }: Props) { | ||
return children; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.