Skip to content

Commit 32267b5

Browse files
committed
added loading icon with material-ui
1 parent 3ac15c0 commit 32267b5

File tree

4 files changed

+38
-6
lines changed

4 files changed

+38
-6
lines changed

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,4 @@
2121
npm-debug.log*
2222
yarn-debug.log*
2323
yarn-error.log*
24-
debug.log
25-
26-
Screenshot.PNG
27-
src/README.md
24+
debug.log

ScreenShoot.png

143 KB
Loading

src/Components/Loading.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import { withStyles } from '@material-ui/core/styles';
4+
import CircularProgress from '@material-ui/core/CircularProgress';
5+
6+
7+
const styles = theme => ({
8+
progress: {
9+
margin: theme.spacing.unit * 2,
10+
},
11+
});
12+
13+
14+
const Loading = ({
15+
classes,
16+
17+
}) => {
18+
19+
return (
20+
<div style={{ textAlign: "center" }}>
21+
<CircularProgress
22+
color="secondary"
23+
className={classes.progress}
24+
/>
25+
</div>
26+
);
27+
}
28+
29+
30+
Loading.propTypes = {
31+
classes: PropTypes.object.isRequired,
32+
};
33+
34+
35+
export default withStyles(styles)(Loading);

src/Containers/App.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// import './App.css';
33
import React, { Component } from 'react';
44
import RepoList from '../Components/RepoList';
5+
import Loading from '../Components/Loading';
56
// import Repo from '../Components/Repo';
67
import axios from 'axios';
78
import moment from 'moment';
@@ -80,7 +81,6 @@ class App extends Component {
8081
page: prevState.page + page,
8182
loading: true,
8283
}))
83-
8484
this.loadRepo();
8585
}
8686

@@ -92,7 +92,7 @@ class App extends Component {
9292
return (
9393
<div>
9494
<RepoList repo={ repo } />
95-
<div> Loading ...</div>
95+
<Loading></Loading>
9696
</div>
9797
)
9898
}

0 commit comments

Comments
 (0)