Back to home

landpad/

config

Version: 0.2.0

Last Updated: Unknown


LandPad Config Template

Handles:

  • pages/_document.tsx
  • pages/_app.tsx
  • next.config.js

Module files

1import type { AppProps } from 'next/app';
2import { IntlProvider } from 'react-intl';
3import { useRouter } from 'next/router';
4import flatten from 'flat';
5import { ChakraProvider, extendTheme } from "@chakra-ui/react";
6import * as locales from '../content/locale';
7import '../styles/tailwind.css'
8
9export default function MyApp({ Component, pageProps }: AppProps) {
10 const router = useRouter();
11 const { locale, defaultLocale, pathname } = router;
12 const localeCopy = locales[locale as keyof typeof locales];
13 const messages: Record<string, unknown> =
14 localeCopy[pathname as keyof typeof localeCopy];
15 // ensure undefined routes have correct copy
16 const flattenedMessages: Record<string, string> = messages
17 ? flatten(messages)
18 : {};
19
20 return (
21 <ChakraProvider
22 theme={extendTheme({
23 fonts: {
24 heading: "var(--font-heading)",
25 body: "var(--font-paragraph)",
26 },
27 })}
28 >
29 <IntlProvider
30 locale={locale ?? defaultLocale ?? 'en'}
31 defaultLocale={defaultLocale}
32 messages={flattenedMessages}
33 >
34 <div className="<%= font %> <%= theme %>">
35 <Component {...pageProps} />
36 </div>
37 </IntlProvider>
38 </ChakraProvider>
39 );
40}

Install


Lift generate


Repository

https://github.com/okeeffed/pkg-lift-landpad

Sections