1
0
Fork 0
mirror of https://github.com/kou029w/_.git synced 2025-01-30 22:08:02 +00:00
This commit is contained in:
Nebel 2020-06-11 20:59:34 +09:00
parent 026b6a9b63
commit 2e3ae535fc
7 changed files with 22 additions and 22 deletions

View file

@ -1,9 +1,9 @@
const NEXT_BASE_PATH = process.env.NEXT_ASSET_PREFIX || "";
module.exports = require("@next/mdx")({
extension: /\.mdx?$/
extension: /\.mdx?$/,
})({
pageExtensions: ["ts", "tsx", "md", "mdx"],
assetPrefix: NEXT_BASE_PATH,
env: { NEXT_BASE_PATH }
env: { NEXT_BASE_PATH },
});

View file

@ -5,7 +5,7 @@ import Document, {
Html,
Head,
Main,
NextScript
NextScript,
} from "next/document";
import { ServerStyleSheets } from "@material-ui/styles";
import { theme } from "../styles/MainTheme";
@ -15,12 +15,12 @@ export default class extends Document {
const originalRenderPage = ctx.renderPage;
ctx.renderPage = () =>
originalRenderPage({
enhanceApp: App => props => sheets.collect(<App {...props} />)
enhanceApp: (App) => (props) => sheets.collect(<App {...props} />),
});
const initialProps = await Document.getInitialProps(ctx);
return {
...initialProps,
styles: [initialProps.styles, sheets.getStyleElement()]
styles: [initialProps.styles, sheets.getStyleElement()],
} as DocumentInitialProps;
};

View file

@ -17,7 +17,7 @@ type Action =
const initialState: State = {
id: 0,
todo: new Map()
todo: new Map(),
};
function reducer(state: State, action: Action) {
@ -44,7 +44,7 @@ export default () => {
if (body.length === 0) return;
dispatch({
type: "add",
body
body,
});
},
[dispatch]

View file

@ -3,6 +3,6 @@ import { Home, Info } from "@material-ui/icons";
const routes = [
{ pathname: "/", icon: createElement(Home) },
{ pathname: "/about", icon: createElement(Info) }
{ pathname: "/about", icon: createElement(Info) },
];
export default routes;

View file

@ -23,21 +23,21 @@ const isValidURL = (url: string) => {
export const theme = createMuiTheme({
palette: {
primary: {
main: orange[900]
main: orange[900],
},
secondary: {
main: teal[400]
}
main: teal[400],
},
},
typography: {
fontFamily: "sans-serif"
}
fontFamily: "sans-serif",
},
});
export const components: {
[key in keyof HTMLElementTagNameMap]?: React.FC<any>;
} = {
h1: props => (
h1: (props) => (
<>
<Head>
<title>{props.children}</title>
@ -45,11 +45,11 @@ export const components: {
<Typography component="h1" variant="h3" {...props} />
</>
),
h2: props => <Typography component="h2" variant="h4" {...props} />,
h3: props => <Typography component="h3" variant="h5" {...props} />,
h4: props => <Typography component="h4" variant="h6" {...props} />,
h5: props => <Typography component="h5" variant="h6" {...props} />,
h6: props => <Typography variant="h6" {...props} />,
h2: (props) => <Typography component="h2" variant="h4" {...props} />,
h3: (props) => <Typography component="h3" variant="h5" {...props} />,
h4: (props) => <Typography component="h4" variant="h6" {...props} />,
h5: (props) => <Typography component="h5" variant="h6" {...props} />,
h6: (props) => <Typography variant="h6" {...props} />,
a: ({ href, ...props }: { href: string }) => {
const url = `${process.env.NEXT_BASE_PATH}${href}`;
return isValidURL(href) ? (
@ -60,7 +60,7 @@ export const components: {
</Link>
);
},
p: props => <Typography component="p" variant="body1" {...props} />
p: (props) => <Typography component="p" variant="body1" {...props} />,
};
const MainTheme: React.FC = ({ children }) => (

View file

@ -10,7 +10,7 @@ const TopAppBar = () => {
const router = useRouter();
const pathname = (
routes.find(({ pathname }) => pathname === router.pathname) || {
pathname: "/"
pathname: "/",
}
).pathname;
return (