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

Typographyなど

This commit is contained in:
Nebel 2019-04-23 18:52:12 +09:00
parent 4cfc54cfd0
commit 9b63fc5230
8 changed files with 46 additions and 24 deletions

View file

@ -1,7 +1,6 @@
import React from "react"; import React from "react";
import App, { Container } from "next/app"; import App, { Container } from "next/app";
import MainTheme from "../styles/MainTheme"; import MainTheme from "../styles/MainTheme";
import TopAppBar from "../styles/TopAppBar";
export default class extends App { export default class extends App {
render() { render() {
@ -9,7 +8,6 @@ export default class extends App {
return ( return (
<Container> <Container>
<MainTheme> <MainTheme>
<TopAppBar />
<Component {...pageProps} /> <Component {...pageProps} />
</MainTheme> </MainTheme>
</Container> </Container>

3
pages/about.md Normal file
View file

@ -0,0 +1,3 @@
# About
- [Back to Home](/)

View file

@ -1,7 +0,0 @@
import Link from "next/link";
# About
<Link href="/">
<a>Back to Home</a>
</Link>

3
pages/index.md Normal file
View file

@ -0,0 +1,3 @@
# Hello Next.js
- [/about](/about)

View file

@ -1,7 +0,0 @@
import Link from "next/link";
# Hello Next.js
<Link href="/about">
<a>/about</a>
</Link>

View file

@ -1,9 +1,18 @@
import "./boot"; import "./boot";
import { ThemeProvider } from "@material-ui/styles"; import { ThemeProvider } from "@material-ui/styles";
import { CssBaseline, createMuiTheme } from "@material-ui/core"; import {
CssBaseline,
createMuiTheme,
Typography,
Link as MuiLink,
Grid
} from "@material-ui/core";
import { orange, teal } from "@material-ui/core/colors"; import { orange, teal } from "@material-ui/core/colors";
import React from "react"; import { MDXProvider } from "@mdx-js/tag";
import React, { ReactElement } from "react";
import Head from "next/head"; import Head from "next/head";
import Link from "next/link";
import TopAppBar from "./TopAppBar";
export const theme = createMuiTheme({ export const theme = createMuiTheme({
palette: { palette: {
@ -20,6 +29,20 @@ export const theme = createMuiTheme({
} }
}); });
export const components = {
h1: (props: {}) => <Typography variant="h1" {...props} />,
h2: (props: {}) => <Typography variant="h2" {...props} />,
h3: (props: {}) => <Typography variant="h3" {...props} />,
h4: (props: {}) => <Typography variant="h4" {...props} />,
h5: (props: {}) => <Typography variant="h5" {...props} />,
h6: (props: {}) => <Typography variant="h6" {...props} />,
a: ({ href, ...props }: { href: string }) => (
<Link href={href}>
<MuiLink variant="body1" href={href} {...props} />
</Link>
)
};
const MainTheme: React.FC<{}> = ({ children }) => ( const MainTheme: React.FC<{}> = ({ children }) => (
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<Head> <Head>
@ -34,7 +57,12 @@ const MainTheme: React.FC<{}> = ({ children }) => (
/> />
</Head> </Head>
<CssBaseline /> <CssBaseline />
{children} <MDXProvider components={components}>
<Typography component="div" variant="body1">
<TopAppBar />
<Grid container>{children}</Grid>
</Typography>
</MDXProvider>
</ThemeProvider> </ThemeProvider>
); );
export default MainTheme; export default MainTheme;

View file

@ -3,10 +3,7 @@
"allowJs": true, "allowJs": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"jsx": "preserve", "jsx": "preserve",
"lib": [ "lib": ["dom", "es2017"],
"dom",
"es2017"
],
"module": "esnext", "module": "esnext",
"moduleResolution": "node", "moduleResolution": "node",
"noEmit": true, "noEmit": true,
@ -20,6 +17,7 @@
"noImplicitAny": true, "noImplicitAny": true,
"noImplicitReturns": true, "noImplicitReturns": true,
"noImplicitThis": true, "noImplicitThis": true,
"target": "esnext" "target": "esnext",
"typeRoots": ["node_modules/@types", "types"]
} }
} }

6
types/@mdx-js/tag.d.ts vendored Normal file
View file

@ -0,0 +1,6 @@
declare module "@mdx-js/tag" {
class MDXProvider extends React.Component<{
components: any;
childlen?: ReactNode;
}> {}
}