-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support _app.js; add withthemeApp example;
- Loading branch information
1 parent
6c69df5
commit 2b53de9
Showing
30 changed files
with
283 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"presets": [ | ||
"next/babel" | ||
], | ||
"plugins": [ | ||
"react-require", | ||
[ | ||
"module-resolver", | ||
{ | ||
"root": [ | ||
"./src/" | ||
], | ||
"alias": { | ||
"material-ui": "@material-ui/core", | ||
"src": "./src" | ||
} | ||
} | ||
] | ||
], | ||
"ignore": ["node_modules/**"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
language: node_js | ||
node_js: | ||
- "6" | ||
- "8" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { DefaultNextApp } from 'nextjs-mui-helper/nextjs/makeNextApp'; | ||
|
||
export default DefaultNextApp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import makeNextDocument from 'nextjs-mui-helper/nextjs/makeNextDocument'; | ||
import { DefaultNextDocument } from 'nextjs-mui-helper/nextjs/makeNextDocument'; | ||
|
||
export default makeNextDocument(); | ||
export default DefaultNextDocument; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
import React from 'react'; | ||
import withParts from 'nextjs-mui-helper/mui/withParts'; | ||
import Button from '@material-ui/core/Button'; | ||
|
||
const Page1 = () => ( | ||
<Button color="primary"> | ||
Hello World | ||
Hello World, Page1! | ||
</Button> | ||
); | ||
|
||
export default withParts()(Page1); | ||
export default Page1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
import React from 'react'; | ||
import Button from '@material-ui/core/Button'; | ||
import Link from 'next/link'; | ||
|
||
import withAll from '../client/hoc/withAll'; | ||
|
||
const Page1 = () => ( | ||
<Button color="primary"> | ||
Hello World | ||
</Button> | ||
<div> | ||
<Button color="primary"> | ||
Hello World Page1! | ||
</Button> | ||
<div> | ||
<Link href="/page2"> | ||
<Button>To Page2</Button> | ||
</Link> | ||
</div> | ||
</div> | ||
); | ||
|
||
export default withAll(Page1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; | ||
import Button from '@material-ui/core/Button'; | ||
import Link from 'next/link'; | ||
|
||
import withAll from '../client/hoc/withAll'; | ||
|
||
const Page2 = () => ( | ||
<div> | ||
<Button color="primary"> | ||
Hello World Page2! | ||
</Button> | ||
<div> | ||
<Link href="/"> | ||
<Button>To Page1</Button> | ||
</Link> | ||
</div> | ||
</div> | ||
); | ||
|
||
export default withAll(Page2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["next/babel"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# build output | ||
npm-debug.log | ||
.next/ | ||
|
||
# dependencies | ||
node_modules/ | ||
|
||
yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
## Description | ||
|
||
Example of inject theme and layout with nextjs-mui-helper by using _app.js. | ||
|
||
## How to use | ||
|
||
[clone the repo](https://github.com/thundermiracle/nextjs-mui-helper) | ||
|
||
```sh | ||
cd examples/withTheme | ||
npm install (yarn) | ||
npm run dev (yarn run dev) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "withthemeapp", | ||
"version": "1.0.0", | ||
"description": "example of inject theme and layout with nextjs-mui-helper and using app.js instead of hoc", | ||
"scripts": { | ||
"dev": "next ./src" | ||
}, | ||
"author": "thundermiracle", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@material-ui/core": "latest", | ||
"@material-ui/icons": "latest", | ||
"next": "latest", | ||
"nextjs-mui-helper": "latest", | ||
"prop-types": "latest", | ||
"react": "latest", | ||
"react-dom": "latest" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { withStyles } from '@material-ui/core/styles'; | ||
import AppBar from '@material-ui/core/AppBar'; | ||
import Toolbar from '@material-ui/core/Toolbar'; | ||
import Typography from '@material-ui/core/Typography'; | ||
|
||
const styles = { | ||
root: { | ||
flexGrow: 1, | ||
}, | ||
flex: { | ||
flex: 1, | ||
}, | ||
menuButton: { | ||
marginLeft: -12, | ||
marginRight: 20, | ||
}, | ||
}; | ||
|
||
function ButtonAppBar(props) { | ||
const { classes, children } = props; | ||
return ( | ||
<div className={classes.root}> | ||
<AppBar position="static"> | ||
<Toolbar> | ||
<Typography variant="title" color="inherit" className={classes.flex}> | ||
Title | ||
</Typography> | ||
</Toolbar> | ||
</AppBar> | ||
{children} | ||
</div> | ||
); | ||
} | ||
|
||
ButtonAppBar.propTypes = { | ||
classes: PropTypes.object.isRequired, | ||
children: PropTypes.any, | ||
}; | ||
|
||
ButtonAppBar.defaultProps = { | ||
children: null, | ||
}; | ||
|
||
export default withStyles(styles)(ButtonAppBar); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { deepOrange, teal } from '@material-ui/core/colors'; | ||
|
||
const theme = { | ||
palette: { | ||
primary: deepOrange, | ||
secondary: teal, | ||
}, | ||
}; | ||
|
||
export default theme; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
distDir: '../.next', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import makeNextApp from 'nextjs-mui-helper/nextjs/makeNextApp'; | ||
|
||
import CommonLayout from '../client/layout/CommonLayout'; | ||
import theme from '../client/style/theme'; | ||
|
||
export default makeNextApp(theme, CommonLayout, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import makeNextDocument from 'nextjs-mui-helper/nextjs/makeNextDocument'; | ||
|
||
import theme from '../client/style/theme'; | ||
|
||
export default makeNextDocument(theme); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react'; | ||
import Button from '@material-ui/core/Button'; | ||
import Link from 'next/link'; | ||
|
||
const Page1 = () => ( | ||
<div> | ||
<Button color="primary"> | ||
Hello World Page1! | ||
</Button> | ||
<div> | ||
<Link href="/page2"> | ||
<Button>To Page2</Button> | ||
</Link> | ||
</div> | ||
</div> | ||
); | ||
|
||
export default Page1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react'; | ||
import Button from '@material-ui/core/Button'; | ||
import Link from 'next/link'; | ||
|
||
const Page2 = () => ( | ||
<div> | ||
<Button color="primary"> | ||
Hello World Page2! | ||
</Button> | ||
<div> | ||
<Link href="/"> | ||
<Button>To Page1</Button> | ||
</Link> | ||
</div> | ||
</div> | ||
); | ||
|
||
export default Page2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { DefaultNextApp } from '../src/nextjs/makeNextApp'; | ||
|
||
export default DefaultNextApp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { DefaultNextDocument } from '../src/nextjs/makeNextDocument'; | ||
|
||
export default DefaultNextDocument; |
Oops, something went wrong.