mirror of
https://github.com/kou029w/_.git
synced 2025-01-30 22:08:02 +00:00
Delete next directory
This commit is contained in:
parent
fcc2731888
commit
fdedd73cbf
20 changed files with 0 additions and 6369 deletions
16
next/.github/workflows/build.yml
vendored
16
next/.github/workflows/build.yml
vendored
|
@ -1,16 +0,0 @@
|
|||
name: build
|
||||
on: push
|
||||
jobs:
|
||||
main:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- id: yarn_cache
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- uses: actions/cache@v1
|
||||
with:
|
||||
path: ${{ steps.yarn_cache.outputs.dir }}
|
||||
key: yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: yarn-
|
||||
- run: yarn
|
||||
- run: yarn build
|
25
next/.github/workflows/docs.yml
vendored
25
next/.github/workflows/docs.yml
vendored
|
@ -1,25 +0,0 @@
|
|||
name: github-pages
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
jobs:
|
||||
main:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
EMAIL: octocat@github.com
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- run: echo "::set-env name=YARN_CACHE_DIR::$(yarn cache dir)"
|
||||
- uses: actions/cache@v1
|
||||
with:
|
||||
path: ${{ env.YARN_CACHE_DIR }}
|
||||
key: yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: yarn-
|
||||
- run: yarn
|
||||
- run: git -c user.name="$(whoami)" subtree add --prefix docs origin gh-pages
|
||||
- run: NEXT_PUBLIC_BASE_PATH=/${GITHUB_REPOSITORY#*/} yarn doc
|
||||
- run: git add -f docs
|
||||
- run: git -c user.name="$(whoami)" commit -m github-pages
|
||||
- run: git remote add github "https://github:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
|
||||
env: { GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" }
|
||||
- run: git subtree push --prefix docs github gh-pages
|
2
next/.gitignore
vendored
2
next/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
/.next/
|
||||
/docs/
|
2
next/next-env.d.ts
vendored
2
next/next-env.d.ts
vendored
|
@ -1,2 +0,0 @@
|
|||
/// <reference types="next" />
|
||||
/// <reference types="next/types/global" />
|
|
@ -1,6 +0,0 @@
|
|||
module.exports = require("@next/mdx")({
|
||||
extension: /\.mdx?$/,
|
||||
})({
|
||||
pageExtensions: ["ts", "tsx", "md", "mdx"],
|
||||
basePath: process.env.NEXT_PUBLIC_BASE_PATH || "",
|
||||
});
|
|
@ -1,28 +0,0 @@
|
|||
{
|
||||
"name": "next-example",
|
||||
"version": "1.0.0",
|
||||
"author": "Kohei Watanabe <kou029w@gmail.com>",
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@material-ui/core": "~4",
|
||||
"@material-ui/icons": "~4",
|
||||
"@material-ui/styles": "~4",
|
||||
"@mdx-js/loader": "~2.0.0-next",
|
||||
"@next/mdx": "~9",
|
||||
"next": "~9",
|
||||
"react": "~16",
|
||||
"react-dom": "~16"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "~12",
|
||||
"npm-run-all": "~4",
|
||||
"typescript": "~3.9.0"
|
||||
},
|
||||
"scripts": {
|
||||
"doc": "run-s build doc:export",
|
||||
"doc:export": "next export -o docs",
|
||||
"build": "next build",
|
||||
"dev": "next"
|
||||
}
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
import React from "react";
|
||||
import App from "next/app";
|
||||
import MainTheme from "../styles/MainTheme";
|
||||
|
||||
export default class extends App {
|
||||
render() {
|
||||
const { Component, pageProps } = this.props;
|
||||
return (
|
||||
<MainTheme>
|
||||
<Component {...pageProps} />
|
||||
</MainTheme>
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
import React from "react";
|
||||
import Document, {
|
||||
DocumentContext,
|
||||
DocumentInitialProps,
|
||||
Html,
|
||||
Head,
|
||||
Main,
|
||||
NextScript,
|
||||
} from "next/document";
|
||||
import { ServerStyleSheets } from "@material-ui/styles";
|
||||
import { theme } from "../styles/MainTheme";
|
||||
export default class extends Document {
|
||||
static getInitialProps = async (ctx: DocumentContext) => {
|
||||
const sheets = new ServerStyleSheets();
|
||||
const originalRenderPage = ctx.renderPage;
|
||||
ctx.renderPage = () =>
|
||||
originalRenderPage({
|
||||
enhanceApp: (App) => (props) => sheets.collect(<App {...props} />),
|
||||
});
|
||||
const initialProps = await Document.getInitialProps(ctx);
|
||||
return {
|
||||
...initialProps,
|
||||
styles: [initialProps.styles, sheets.getStyleElement()],
|
||||
} as DocumentInitialProps;
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Html lang="ja" dir="ltr">
|
||||
<Head>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||
<meta name="theme-color" content={theme.palette.primary.main} />
|
||||
</Head>
|
||||
<body>
|
||||
<Main />
|
||||
<NextScript />
|
||||
</body>
|
||||
</Html>
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
# About
|
||||
|
||||
Next.js、MDX、Material-UI の組み合わせで作ってみたサンプルページ。
|
||||
|
||||
## ソースコード
|
||||
|
||||
[https://github.com/kou029w/next-example](https://github.com/kou029w/next-example)
|
||||
|
||||
## ライセンス
|
||||
|
||||
MIT
|
|
@ -1,4 +0,0 @@
|
|||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
export const handler = (req: NextApiRequest, res: NextApiResponse) =>
|
||||
res.json(req.headers);
|
||||
export default handler;
|
|
@ -1,4 +0,0 @@
|
|||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
export const handler = (req: NextApiRequest, res: NextApiResponse) =>
|
||||
res.json(req.query);
|
||||
export default handler;
|
|
@ -1,6 +0,0 @@
|
|||
import Todo from "./todo"
|
||||
|
||||
# Hello Next.js
|
||||
|
||||
- [About](/about)
|
||||
- [ToDo List](/todo)
|
|
@ -1,14 +0,0 @@
|
|||
import { useRouter } from "next/router";
|
||||
|
||||
export function getStaticPaths() {
|
||||
return { paths: [{ params: { path: "test" } }], fallback: false };
|
||||
}
|
||||
|
||||
export function getStaticProps({ params }: { params: unknown }) {
|
||||
return { props: params };
|
||||
}
|
||||
|
||||
export default function ({ path }: { path: string }) {
|
||||
const { query } = useRouter();
|
||||
return <pre>{JSON.stringify({ path, ...query }, null, " ")}</pre>;
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
import React, { FormEvent } from "react";
|
||||
import { MDXContext } from "@mdx-js/react";
|
||||
|
||||
type State = {
|
||||
id: number;
|
||||
todo: Map<number, string>;
|
||||
};
|
||||
type Action =
|
||||
| {
|
||||
type: "add";
|
||||
body: string;
|
||||
}
|
||||
| {
|
||||
type: "delete";
|
||||
key: number;
|
||||
};
|
||||
|
||||
const initialState: State = {
|
||||
id: 0,
|
||||
todo: new Map(),
|
||||
};
|
||||
|
||||
function reducer(state: State, action: Action) {
|
||||
switch (action.type) {
|
||||
case "add":
|
||||
state.todo.set(state.id, action.body);
|
||||
return { ...state, id: state.id + 1 };
|
||||
case "delete":
|
||||
state.todo.delete(action.key);
|
||||
return { ...state };
|
||||
}
|
||||
}
|
||||
|
||||
export default () => {
|
||||
const { components } = React.useContext(MDXContext);
|
||||
const [state, dispatch] = React.useReducer(reducer, initialState);
|
||||
const onSubmit = React.useCallback(
|
||||
(event: FormEvent) => {
|
||||
event.preventDefault();
|
||||
const body =
|
||||
new FormData(event.currentTarget as HTMLFormElement)
|
||||
.get("body")
|
||||
?.toString() || "";
|
||||
if (body.length === 0) return;
|
||||
dispatch({
|
||||
type: "add",
|
||||
body,
|
||||
});
|
||||
},
|
||||
[dispatch]
|
||||
);
|
||||
|
||||
const H1 = components?.h1 ?? "h1";
|
||||
const Ul = components?.ul ?? "ul";
|
||||
const Li = components?.li ?? "li";
|
||||
|
||||
return (
|
||||
<>
|
||||
<H1>ToDo List</H1>
|
||||
<form onSubmit={onSubmit}>
|
||||
<input type="text" key={state.id} name="body" autoFocus />
|
||||
<input type="submit" name="submit" value="+" />
|
||||
</form>
|
||||
<Ul>
|
||||
{[...state.todo].map(([key, body]) => (
|
||||
<Li key={key}>
|
||||
<input
|
||||
type="checkbox"
|
||||
name={`${key}-checkbox`}
|
||||
onChange={() => dispatch({ type: "delete", key })}
|
||||
/>
|
||||
{body}
|
||||
</Li>
|
||||
))}
|
||||
</Ul>
|
||||
</>
|
||||
);
|
||||
};
|
|
@ -1,8 +0,0 @@
|
|||
import { createElement } from "react";
|
||||
import { Home, Info } from "@material-ui/icons";
|
||||
|
||||
const routes = [
|
||||
{ pathname: "/", icon: createElement(Home) },
|
||||
{ pathname: "/about", icon: createElement(Info) },
|
||||
];
|
||||
export default routes;
|
|
@ -1,74 +0,0 @@
|
|||
import React, { ReactElement } from "react";
|
||||
import { ThemeProvider } from "@material-ui/styles";
|
||||
import { createMuiTheme } from "@material-ui/core/styles";
|
||||
import { orange, teal } from "@material-ui/core/colors";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import MuiLink from "@material-ui/core/Link";
|
||||
import Box from "@material-ui/core/Box";
|
||||
import Container from "@material-ui/core/Container";
|
||||
import { MDXProvider, ComponentDictionary } from "@mdx-js/react";
|
||||
import Head from "next/head";
|
||||
import Link from "next/link";
|
||||
import TopAppBar from "./TopAppBar";
|
||||
|
||||
const isValidURL = (url: string) => {
|
||||
try {
|
||||
new URL(url);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
export const theme = createMuiTheme({
|
||||
palette: {
|
||||
primary: {
|
||||
main: orange[900],
|
||||
},
|
||||
secondary: {
|
||||
main: teal[400],
|
||||
},
|
||||
},
|
||||
typography: {
|
||||
fontFamily: "sans-serif",
|
||||
},
|
||||
});
|
||||
|
||||
export const components: ComponentDictionary = {
|
||||
h1: (props) => (
|
||||
<>
|
||||
<Head>
|
||||
<title>{props.children}</title>
|
||||
</Head>
|
||||
<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} />,
|
||||
a: ({ href, ...props }: { href: string }) => {
|
||||
const url = [process.env.NEXT_PUBLIC_BASE_PATH, href].join("");
|
||||
return isValidURL(href) ? (
|
||||
<MuiLink variant="body1" color="secondary" href={href} {...props} />
|
||||
) : (
|
||||
<Link href={href}>
|
||||
<MuiLink variant="body1" color="secondary" href={url} {...props} />
|
||||
</Link>
|
||||
);
|
||||
},
|
||||
p: (props) => <Typography component="p" variant="body1" {...props} />,
|
||||
};
|
||||
|
||||
const MainTheme = (props: { children: ReactElement }) => (
|
||||
<ThemeProvider theme={theme}>
|
||||
<MDXProvider components={components}>
|
||||
<TopAppBar />
|
||||
<Box paddingTop={6}>
|
||||
<Container>{props.children}</Container>
|
||||
</Box>
|
||||
</MDXProvider>
|
||||
</ThemeProvider>
|
||||
);
|
||||
export default MainTheme;
|
|
@ -1,53 +0,0 @@
|
|||
import React from "react";
|
||||
import { useRouter } from "next/router";
|
||||
import Link from "next/link";
|
||||
import AppBar from "@material-ui/core/AppBar";
|
||||
import Tabs from "@material-ui/core/Tabs";
|
||||
import Tab from "@material-ui/core/Tab";
|
||||
import routes from "../routes";
|
||||
|
||||
const basePath = process.env.NEXT_PUBLIC_BASE_PATH ?? "";
|
||||
|
||||
const TopAppBar = () => {
|
||||
const router = useRouter();
|
||||
const currentPathname = React.useMemo(
|
||||
() =>
|
||||
router.pathname.startsWith(basePath)
|
||||
? router.pathname.slice(basePath.length)
|
||||
: router.pathname,
|
||||
[router.pathname]
|
||||
);
|
||||
const tabPathname = React.useMemo(
|
||||
() =>
|
||||
routes.reduce(
|
||||
(prev, { pathname }) =>
|
||||
pathname === currentPathname ? pathname : prev,
|
||||
"/"
|
||||
),
|
||||
[currentPathname]
|
||||
);
|
||||
return (
|
||||
<AppBar color="default">
|
||||
<Tabs
|
||||
value={tabPathname}
|
||||
variant="fullWidth"
|
||||
indicatorColor="primary"
|
||||
textColor="primary"
|
||||
>
|
||||
{routes.map(({ pathname, icon }, index) => (
|
||||
<Tab
|
||||
key={index}
|
||||
value={pathname}
|
||||
icon={icon}
|
||||
component={React.forwardRef<HTMLAnchorElement, {}>((props, ref) => (
|
||||
<Link href={pathname}>
|
||||
<a ref={ref} href={[basePath, pathname].join("")} {...props} />
|
||||
</Link>
|
||||
))}
|
||||
/>
|
||||
))}
|
||||
</Tabs>
|
||||
</AppBar>
|
||||
);
|
||||
};
|
||||
export default TopAppBar;
|
|
@ -1,26 +0,0 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitReturns": true,
|
||||
"noImplicitThis": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve",
|
||||
"downlevelIteration": true
|
||||
},
|
||||
"exclude": ["node_modules"],
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]
|
||||
}
|
5957
next/yarn.lock
5957
next/yarn.lock
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue