Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 43 additions & 11 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,21 +1,53 @@
{
"env": {
"test": {
"plugins": ["istanbul"]
"plugins": [
"istanbul"
]
}
},
"presets": [
"@babel/react",
["@babel/env", {
"targets": {
"browsers": ["> 1%", "iOS >= 8", "Android >= 4"],
"node": "6.10"
},
"debug": false
}]
[
"@babel/preset-env",
{
"targets": {
"browsers": [
"ie >= 11",
"> 1%",
"iOS >= 8",
"Android >= 4"
],
"node": "6.10"
},
"useBuiltIns": "usage",
"debug": false,
"modules": false,
"corejs": {
"version": 3,
"proposals": true
Comment on lines +14 to +27
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set core-js

}
}
],
[
"@babel/preset-react"
]
],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread"
[
"@babel/plugin-proposal-class-properties"
],
[
"@babel/plugin-proposal-object-rest-spread"
],
[
"@babel/plugin-transform-async-to-generator"
],
[
"@babel/plugin-transform-runtime",
{
"corejs": 3,
"regenerator": true
}
]
Comment on lines +46 to +51
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set core-js

]
}
24 changes: 17 additions & 7 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
{
"parser": "babel-eslint",
"settings": {
"import/extensions": [".js"],
"react": {
"version": "latest"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add version

},
"import/extensions": [
".js"
],
"import/parser": "babel-eslint",
"import/resolver": {
"node": {
"extensions": [".js"]
"extensions": [
".js"
]
},
"webpack": {
"config": "webpack.config.js"
Expand All @@ -19,7 +26,7 @@
"ecmaFeatures": {
"jsx": true,
"experimentalObjectRestSpread": true
},
}
},
"env": {
"es6": true,
Expand All @@ -28,7 +35,7 @@
"node": true
},
"extends": [
"plugin:jsx-a11y/recommended"
"plugin:jsx-a11y/recommended"
],
"rules": {
"no-console": "off",
Expand All @@ -41,9 +48,12 @@
"react/jsx-no-duplicate-props": "warn",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"jsx-a11y/no-autofocus": [ 2, {
"ignoreNonDOM": true
}]
"jsx-a11y/no-autofocus": [
2,
{
"ignoreNonDOM": true
}
]
},
"plugins": [
"import",
Expand Down
92 changes: 50 additions & 42 deletions examples/Router/index.js
Original file line number Diff line number Diff line change
@@ -1,54 +1,62 @@
import React from 'react';
import ReactDOM from 'react-dom';
import {HashRouter as Router, Route, Switch} from 'react-router-dom';
import {withStyles} from "@material-ui/core/styles/index";
import ExamplesGrid from "./ExamplesGrid";
import examples from "../examples";
import Button from "@material-ui/core/Button";
import {withRouter} from 'react-router-dom';
import { HashRouter as Router, Route, Switch } from 'react-router-dom';
import { withStyles } from '@material-ui/core/styles/index';
import ExamplesGrid from './ExamplesGrid';
import examples from '../examples';
import Button from '@material-ui/core/Button';
import { withRouter } from 'react-router-dom';

const styles = {
root: {
display: 'flex',
justifyContent: 'center',
},
contentWrapper: {
width: '100%',
},
root: {
display: 'flex',
justifyContent: 'center',
},
contentWrapper: {
width: '100%',
},
};

class Examples extends React.Component {
returnHome = () => {
this.props.history.push('/');
};

returnHome = () => {
this.props.history.push('/');
};

render() {
const {classes} = this.props;

var returnHomeStyle = {padding:'0px', margin:'20px 0 20px 0'};

return <main className={classes.root}>
<div className={classes.contentWrapper}>
<Switch>
<Route path="/" exact render={() => <ExamplesGrid examples={examples}/>}/>
{Object.keys(examples).map((label, index) => (
<Route key={index} path={`/${label.replace(/\s+/g, '-').toLowerCase()}`} exact component={examples[label]}/>
))}
</Switch>
<div>
{this.props.location.pathname !== '/' && (
<div style={returnHomeStyle}>
<Button color="primary" onClick={this.returnHome}>Back to Example Index</Button>
</div>
)}
</div>
</div>
</main>;
}
render() {
const { classes } = this.props;

var returnHomeStyle = { padding: '0px', margin: '20px 0 20px 0' };

return (
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as-is

return <main>
             ....
       </main>

to-be

return  ( 
           <main
            ...
           </main>
)

<main className={classes.root}>
<div className={classes.contentWrapper}>
<Switch>
<Route path="/" exact render={() => <ExamplesGrid examples={examples} />} />
{Object.keys(examples).map((label, index) => (
<Route
key={index}
path={`/${label.replace(/\s+/g, '-').toLowerCase()}`}
exact
component={examples[label]}
/>
))}
</Switch>
<div>
{this.props.location.pathname !== '/' && (
<div style={returnHomeStyle}>
<Button color="primary" onClick={this.returnHome}>
Back to Example Index
</Button>
</div>
)}
</div>
</div>
</main>
);
}
}

const StyledExamples = withRouter( withStyles(styles)(Examples) );
const StyledExamples = withRouter(withStyles(styles)(Examples));

function App() {
return (
Expand All @@ -58,4 +66,4 @@ function App() {
);
}

ReactDOM.render(<App/>, document.getElementById('app-root'));
ReactDOM.render(<App />, document.getElementById('app-root'));
Loading