mirror of
https://github.com/kou029w/_.git
synced 2025-01-30 22:08:02 +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 || "";
|
||||
|
||||
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 },
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ export function getStaticProps({ params }: { params: unknown }) {
|
|||
return { props: params };
|
||||
}
|
||||
|
||||
export default function({ path }: { path: string }) {
|
||||
export default function ({ path }: { path: string }) {
|
||||
const { query } = useRouter();
|
||||
return <pre>{JSON.stringify({ path, ...query }, null, " ")}</pre>;
|
||||
}
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 }) => (
|
||||
|
|
|
@ -10,7 +10,7 @@ const TopAppBar = () => {
|
|||
const router = useRouter();
|
||||
const pathname = (
|
||||
routes.find(({ pathname }) => pathname === router.pathname) || {
|
||||
pathname: "/"
|
||||
pathname: "/",
|
||||
}
|
||||
).pathname;
|
||||
return (
|
||||
|
|
Loading…
Add table
Reference in a new issue