mirror of
https://github.com/kou029w/_.git
synced 2025-01-31 06:18:07 +00:00
format
This commit is contained in:
parent
026b6a9b63
commit
2e3ae535fc
7 changed files with 22 additions and 22 deletions
|
@ -1,9 +1,9 @@
|
||||||
const NEXT_BASE_PATH = process.env.NEXT_ASSET_PREFIX || "";
|
const NEXT_BASE_PATH = process.env.NEXT_ASSET_PREFIX || "";
|
||||||
|
|
||||||
module.exports = require("@next/mdx")({
|
module.exports = require("@next/mdx")({
|
||||||
extension: /\.mdx?$/
|
extension: /\.mdx?$/,
|
||||||
})({
|
})({
|
||||||
pageExtensions: ["ts", "tsx", "md", "mdx"],
|
pageExtensions: ["ts", "tsx", "md", "mdx"],
|
||||||
assetPrefix: NEXT_BASE_PATH,
|
assetPrefix: NEXT_BASE_PATH,
|
||||||
env: { NEXT_BASE_PATH }
|
env: { NEXT_BASE_PATH },
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,7 +5,7 @@ import Document, {
|
||||||
Html,
|
Html,
|
||||||
Head,
|
Head,
|
||||||
Main,
|
Main,
|
||||||
NextScript
|
NextScript,
|
||||||
} from "next/document";
|
} from "next/document";
|
||||||
import { ServerStyleSheets } from "@material-ui/styles";
|
import { ServerStyleSheets } from "@material-ui/styles";
|
||||||
import { theme } from "../styles/MainTheme";
|
import { theme } from "../styles/MainTheme";
|
||||||
|
@ -15,12 +15,12 @@ export default class extends Document {
|
||||||
const originalRenderPage = ctx.renderPage;
|
const originalRenderPage = ctx.renderPage;
|
||||||
ctx.renderPage = () =>
|
ctx.renderPage = () =>
|
||||||
originalRenderPage({
|
originalRenderPage({
|
||||||
enhanceApp: App => props => sheets.collect(<App {...props} />)
|
enhanceApp: (App) => (props) => sheets.collect(<App {...props} />),
|
||||||
});
|
});
|
||||||
const initialProps = await Document.getInitialProps(ctx);
|
const initialProps = await Document.getInitialProps(ctx);
|
||||||
return {
|
return {
|
||||||
...initialProps,
|
...initialProps,
|
||||||
styles: [initialProps.styles, sheets.getStyleElement()]
|
styles: [initialProps.styles, sheets.getStyleElement()],
|
||||||
} as DocumentInitialProps;
|
} as DocumentInitialProps;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ type Action =
|
||||||
|
|
||||||
const initialState: State = {
|
const initialState: State = {
|
||||||
id: 0,
|
id: 0,
|
||||||
todo: new Map()
|
todo: new Map(),
|
||||||
};
|
};
|
||||||
|
|
||||||
function reducer(state: State, action: Action) {
|
function reducer(state: State, action: Action) {
|
||||||
|
@ -44,7 +44,7 @@ export default () => {
|
||||||
if (body.length === 0) return;
|
if (body.length === 0) return;
|
||||||
dispatch({
|
dispatch({
|
||||||
type: "add",
|
type: "add",
|
||||||
body
|
body,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
[dispatch]
|
[dispatch]
|
||||||
|
|
|
@ -3,6 +3,6 @@ import { Home, Info } from "@material-ui/icons";
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{ pathname: "/", icon: createElement(Home) },
|
{ pathname: "/", icon: createElement(Home) },
|
||||||
{ pathname: "/about", icon: createElement(Info) }
|
{ pathname: "/about", icon: createElement(Info) },
|
||||||
];
|
];
|
||||||
export default routes;
|
export default routes;
|
||||||
|
|
|
@ -23,21 +23,21 @@ const isValidURL = (url: string) => {
|
||||||
export const theme = createMuiTheme({
|
export const theme = createMuiTheme({
|
||||||
palette: {
|
palette: {
|
||||||
primary: {
|
primary: {
|
||||||
main: orange[900]
|
main: orange[900],
|
||||||
},
|
},
|
||||||
secondary: {
|
secondary: {
|
||||||
main: teal[400]
|
main: teal[400],
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
typography: {
|
typography: {
|
||||||
fontFamily: "sans-serif"
|
fontFamily: "sans-serif",
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const components: {
|
export const components: {
|
||||||
[key in keyof HTMLElementTagNameMap]?: React.FC<any>;
|
[key in keyof HTMLElementTagNameMap]?: React.FC<any>;
|
||||||
} = {
|
} = {
|
||||||
h1: props => (
|
h1: (props) => (
|
||||||
<>
|
<>
|
||||||
<Head>
|
<Head>
|
||||||
<title>{props.children}</title>
|
<title>{props.children}</title>
|
||||||
|
@ -45,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) ? (
|
||||||
|
@ -60,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 }) => (
|
||||||
|
|
|
@ -10,7 +10,7 @@ const TopAppBar = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const pathname = (
|
const pathname = (
|
||||||
routes.find(({ pathname }) => pathname === router.pathname) || {
|
routes.find(({ pathname }) => pathname === router.pathname) || {
|
||||||
pathname: "/"
|
pathname: "/",
|
||||||
}
|
}
|
||||||
).pathname;
|
).pathname;
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Add table
Reference in a new issue