diff --git a/next-env.d.ts b/next-env.d.ts index 2620bff..c9a6f33 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -2,7 +2,7 @@ /// declare module "@mdx-js/react" { let MDXProvider: React.FC<{ - components?: object; + components: any; childlen?: ReactNode; }>; } diff --git a/styles/MainTheme.tsx b/styles/MainTheme.tsx index 5d3df7b..2adff78 100644 --- a/styles/MainTheme.tsx +++ b/styles/MainTheme.tsx @@ -6,7 +6,7 @@ import MuiLink from "@material-ui/core/Link"; import Box from "@material-ui/core/Box"; import Container from "@material-ui/core/Container"; import { MDXProvider } from "@mdx-js/react"; -import React, { ReactNode } from "react"; +import React from "react"; import Head from "next/head"; import Link from "next/link"; import TopAppBar from "./TopAppBar"; @@ -34,8 +34,10 @@ export const theme = createMuiTheme({ } }); -export const components = { - h1: (props: { children: ReactNode }) => ( +export const components: { + [key in keyof HTMLElementTagNameMap]?: React.FC; +} = { + h1: props => ( <> {props.children} @@ -43,11 +45,11 @@ export const components = { ), - h2: (props: {}) => , - h3: (props: {}) => , - h4: (props: {}) => , - h5: (props: {}) => , - h6: (props: {}) => , + h2: props => , + h3: props => , + h4: props => , + h5: props => , + h6: props => , a: ({ href, ...props }: { href: string }) => { const url = `${process.env.NEXT_BASE_PATH}${href}`; return isValidURL(href) ? ( @@ -58,7 +60,7 @@ export const components = { ); }, - p: (props: {}) => + p: props => }; const MainTheme: React.FC = ({ children }) => (