1
0
Fork 0
mirror of https://github.com/kou029w/_.git synced 2025-01-31 06:18:07 +00:00

型を整理

This commit is contained in:
Nebel 2020-02-09 04:27:05 +09:00
parent a27ea730b9
commit bed7a2c6e3
2 changed files with 12 additions and 10 deletions

2
next-env.d.ts vendored
View file

@ -2,7 +2,7 @@
/// <reference types="next/types/global" /> /// <reference types="next/types/global" />
declare module "@mdx-js/react" { declare module "@mdx-js/react" {
let MDXProvider: React.FC<{ let MDXProvider: React.FC<{
components?: object; components: any;
childlen?: ReactNode; childlen?: ReactNode;
}>; }>;
} }

View file

@ -6,7 +6,7 @@ import MuiLink from "@material-ui/core/Link";
import Box from "@material-ui/core/Box"; import Box from "@material-ui/core/Box";
import Container from "@material-ui/core/Container"; import Container from "@material-ui/core/Container";
import { MDXProvider } from "@mdx-js/react"; import { MDXProvider } from "@mdx-js/react";
import React, { ReactNode } from "react"; import React from "react";
import Head from "next/head"; import Head from "next/head";
import Link from "next/link"; import Link from "next/link";
import TopAppBar from "./TopAppBar"; import TopAppBar from "./TopAppBar";
@ -34,8 +34,10 @@ export const theme = createMuiTheme({
} }
}); });
export const components = { export const components: {
h1: (props: { children: ReactNode }) => ( [key in keyof HTMLElementTagNameMap]?: React.FC<any>;
} = {
h1: props => (
<> <>
<Head> <Head>
<title>{props.children}</title> <title>{props.children}</title>
@ -43,11 +45,11 @@ export const components = {
<Typography component="h1" variant="h3" {...props} /> <Typography component="h1" variant="h3" {...props} />
</> </>
), ),
h2: (props: {}) => <Typography component="h2" variant="h4" {...props} />, h2: props => <Typography component="h2" variant="h4" {...props} />,
h3: (props: {}) => <Typography component="h3" variant="h5" {...props} />, h3: props => <Typography component="h3" variant="h5" {...props} />,
h4: (props: {}) => <Typography component="h4" variant="h6" {...props} />, h4: props => <Typography component="h4" variant="h6" {...props} />,
h5: (props: {}) => <Typography component="h5" variant="h6" {...props} />, h5: props => <Typography component="h5" variant="h6" {...props} />,
h6: (props: {}) => <Typography variant="h6" {...props} />, h6: props => <Typography variant="h6" {...props} />,
a: ({ href, ...props }: { href: string }) => { a: ({ href, ...props }: { href: string }) => {
const url = `${process.env.NEXT_BASE_PATH}${href}`; const url = `${process.env.NEXT_BASE_PATH}${href}`;
return isValidURL(href) ? ( return isValidURL(href) ? (
@ -58,7 +60,7 @@ export const components = {
</Link> </Link>
); );
}, },
p: (props: {}) => <Typography component="p" variant="body1" {...props} /> p: props => <Typography component="p" variant="body1" {...props} />
}; };
const MainTheme: React.FC = ({ children }) => ( const MainTheme: React.FC = ({ children }) => (