Learning build a themes by @rocketseat
using NextJS and Chakra-ui to build theme templates
yarn create next-app <name-app>
add dependencies of the developments
yarn add typescript @types/react @types/node -D
yarn add @chakra-ui/core @emotion/core @emotion/styled emotion-theming
index.js
toindex.tsx
_app.js
to_app.tsx
- into
index.tsx
remove styles imports
api
folder into pagesREADME.md
styles
folder
yarn dev
//theme.ts
import { theme, DefaultTheme } from '@chakra-ui/core';
const customTheme: DefaultTheme = {
...theme,
};
export default customTheme;
//ThemeContainer.ts
import React from 'react';
import {
ThemeProvider as ChakraThemeProvider,
ColorModeProvider,
CSSReset,
} from '@chakra-ui/core';
import { ThemeProvider as EmotionThemeProvider } from 'emotion-theming';
import theme from '../../styles/theme';
const ThemeContainer: React.FC = ({ children }) => {
return (
<ChakraThemeProvider theme={theme}>
<ColorModeProvider value={'dark'}>
<EmotionThemeProvider theme={theme}>
<CSSReset />
{children}
</EmotionThemeProvider>
</ColorModeProvider>
</ChakraThemeProvider>
);
};