Skip to content

Commit a5af042

Browse files
author
username
committed
first commit
0 parents  commit a5af042

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+9825
-0
lines changed

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Editor configuration, see http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
max_line_length = off
13+
trim_trailing_whitespace = false

.env

Whitespace-only changes.

.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
### https://raw.github.com/github/gitignore/656f766bfc75f912d611a973158be0fe9e2ba2f2/Node.gitignore
2+
3+
# Logs
4+
logs
5+
*.log
6+
npm-debug.log*
7+
8+
# Runtime data
9+
pids
10+
*.pid
11+
*.seed
12+
13+
# Directory for instrumented libs generated by jscoverage/JSCover
14+
lib-cov
15+
16+
# Coverage directory used by tools like istanbul
17+
coverage
18+
19+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
20+
.grunt
21+
22+
# node-waf configuration
23+
.lock-wscript
24+
25+
# Compiled binary addons (http://nodejs.org/api/addons.html)
26+
build/Release
27+
28+
# Dependency directory
29+
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
30+
node_modules
31+
32+
# Optional npm cache directory
33+
.npm
34+
35+
# Optional REPL history
36+
.node_repl_history
37+
38+
39+
## Application
40+
.next
41+
.now

.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"singleQuote": false,
3+
"trailingComma": "es5",
4+
"semi": false
5+
}

.vscode/settings.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"files.exclude": {
3+
"**/.DS_Store": true,
4+
"**/node_modules": true
5+
},
6+
"search.exclude": {
7+
"**/node_modules": true,
8+
".next": true
9+
},
10+
"files.insertFinalNewline": true,
11+
"javascript.format.enable": false,
12+
"editor.codeActionsOnSave": {
13+
"source.fixAll.tslint": true
14+
},
15+
"[javascript]": {
16+
"editor.formatOnSave": true,
17+
"editor.formatOnPaste": true,
18+
"editor.codeActionsOnSave": {
19+
"source.organizeImports": true
20+
}
21+
},
22+
"[typescript]": {
23+
"editor.formatOnSave": true,
24+
"editor.formatOnPaste": true,
25+
"editor.codeActionsOnSave": {
26+
"source.organizeImports": true
27+
}
28+
},
29+
"[typescriptreact]": {
30+
"editor.formatOnSave": true,
31+
"editor.formatOnPaste": true,
32+
"editor.codeActionsOnSave": {
33+
"source.organizeImports": true
34+
}
35+
},
36+
"[jsonc]": {
37+
"editor.formatOnSave": true,
38+
"editor.formatOnPaste": true
39+
}
40+
}

README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# typescript-nextjs-redux-toolkit-material-ui-example
2+
3+
This is a sample for `server-side rendering` using `TypeScript` , `Next.js` , `Redux Toolkit` , and `Material-UI` .
4+
5+
`VSCode` , `prettier` and `TSLint` provide real-time formatting, syntax checking and organizing of unused imports.
6+
7+
これは、 `TypeScript` , `Next.js` , `Redux Toolkit` , `Material-UI` を使った `サーバーサイドレンダリング` に対応したサンプルです。
8+
9+
`VSCode``prettier``TSLint` によって、リアルタイムに整形と構文チェックと未使用 import の整理が行われます。
10+
11+
## Live demo
12+
13+
[live demo](https://typescript-nextjs-redux-toolkit-material-ui-example.now.sh/)
14+
15+
## Features
16+
17+
- [Visual Studio Code](https://code.visualstudio.com/)
18+
- [Typescript](https://www.typescriptlang.org/)
19+
- [Next.js](https://nextjs.org/)
20+
- [Material-UI](https://material-ui.com/)
21+
- [Redux](https://redux.js.org/)
22+
- [Redux Toolkit](https://redux-toolkit.js.org/)
23+
- [TSLint](https://palantir.github.io/tslint/)
24+
25+
## Requirement
26+
27+
- [Google Chrome](https://www.google.com/intl/ja_ALL/chrome/)
28+
- [Visual Studio Code](https://code.visualstudio.com/)
29+
- TypeScript v3.7 or higher( [require Optional Chaining](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#optional-chaining) )
30+
31+
## Install Google Chrome addon
32+
33+
- [Redux DevTools](https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd?hl=ja)
34+
35+
## Recommended VSCode addons
36+
37+
- [EditorConfig for VS Code](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig)
38+
- [Prettier - Code formatter](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
39+
- [TSLint](https://marketplace.visualstudio.com/items?itemName=eg2.tslint)
40+
41+
## Usage
42+
43+
### Download and install
44+
45+
```bash
46+
git clone https://github.com/treetips/typescript-nextjs-redux-toolkit-material-ui-example.git
47+
cd typescript-nextjs-redux-toolkit-material-ui-example
48+
npm i
49+
```
50+
51+
### Start local
52+
53+
```bash
54+
npm run dev
55+
```
56+
57+
### Build and start production express server
58+
59+
```bash
60+
npm run build
61+
npm start
62+
```
63+
64+
## Related repository
65+
66+
* [typescript-nextjs-redux-material-ui-example](https://github.com/treetips/typescript-nextjs-redux-material-ui-example)

components/AppContext.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { DocumentContext } from "next/document"
2+
import { Store } from "redux"
3+
4+
/**
5+
* NextDocumentContext with redux store context
6+
* @tree
7+
*/
8+
export type AppContext = DocumentContext & {
9+
readonly store: Store
10+
}

components/MuiTheme.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import green from "@material-ui/core/colors/green"
2+
import grey from "@material-ui/core/colors/grey"
3+
import { createMuiTheme } from "@material-ui/core/styles"
4+
5+
/**
6+
* material-ui theme color pallete
7+
* @see https://material-ui.com/style/color/
8+
*/
9+
export const MuiTheme = createMuiTheme({
10+
palette: {
11+
primary: {
12+
light: grey[700],
13+
main: grey[800],
14+
dark: grey[900],
15+
},
16+
secondary: {
17+
light: green[300],
18+
main: green[500],
19+
dark: green[700],
20+
},
21+
},
22+
})

components/atoms/SpacingPaper.tsx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { Paper } from "@material-ui/core"
2+
import { createStyles, makeStyles, Theme } from "@material-ui/core/styles"
3+
4+
const useStyles = makeStyles<Theme, Props>((theme: Theme) =>
5+
createStyles({
6+
root: (props: Props) => ({
7+
padding: props.noPadding === true ? theme.spacing(0) : theme.spacing(2),
8+
marginBottom: theme.spacing(2),
9+
}),
10+
})
11+
)
12+
13+
type Props = {
14+
/**
15+
* shildren
16+
*/
17+
children: React.ReactNode
18+
/**
19+
* zero-padding flag
20+
*/
21+
noPadding?: boolean
22+
}
23+
24+
/**
25+
* Paper with spacing
26+
* @param props IProps
27+
*/
28+
export const SpacingPaper = (props: Props) => {
29+
const { children } = props
30+
const classes = useStyles(props)
31+
return (
32+
<Paper className={classes.root} elevation={6}>
33+
{children}
34+
</Paper>
35+
)
36+
}

components/atoms/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./SpacingPaper"

0 commit comments

Comments
 (0)