5a478b4eef
Changes: - Migrate to TypeScript. `react-intl` natively supports TypeScript now. - Upgrade corresponding `formatjs` packages. - Dynamically polyfill Intl API per locale since those polyfills are huge. - Migrate to recommended workflow per https://formatjs.io/docs/getting-started/application-workflow
28 lines
576 B
TypeScript
28 lines
576 B
TypeScript
import * as React from 'react';
|
|
import {useIntl} from 'react-intl';
|
|
import Head from 'next/head';
|
|
import Nav from './Nav';
|
|
|
|
export default function Layout({title, children}) {
|
|
const intl = useIntl();
|
|
|
|
return (
|
|
<div>
|
|
<Head>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<title>
|
|
{title ||
|
|
intl.formatMessage({
|
|
defaultMessage: 'React Intl Next.js Example',
|
|
})}
|
|
</title>
|
|
</Head>
|
|
|
|
<header>
|
|
<Nav />
|
|
</header>
|
|
|
|
{children}
|
|
</div>
|
|
);
|
|
}
|