Skip to content

Commit

Permalink
Merge pull request #108 from lazywithclass/adding-loading-component
Browse files Browse the repository at this point in the history
Adding loading component
  • Loading branch information
lightandluck authored Aug 20, 2017
2 parents 8d23835 + fd327cf commit 18fd340
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 34 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,4 @@ archives/.idea/
.env
.vscode/
.DS_Store
dist
7 changes: 7 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ gulp.task('css', function () {
return gulp.src('src/css/*').pipe(gulp.dest('dist/css'));
});

gulp.task("default", ["css", "img", "browserify"]);

gulp.task("img", function () {
return gulp.src('src/img/*').pipe(gulp.dest('dist/img'));
});

gulp.task('browserify', function () {
return browserify({
basedir: '.',
Expand All @@ -27,4 +33,5 @@ gulp.task('browserify', function () {
gulp.task('watch', function() {
gulp.watch('src/**/*.{js,jsx}', ['browserify']);
gulp.watch('src/**/*.css', ['css']);
gulp.watch('src/img/*', ['img']);
});
12 changes: 12 additions & 0 deletions src/components/loading.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';

export default class Loading extends React.Component {

constructor () {
super();
}

render () {
return (<div className="loading">&nbsp;</div>)
}
}
4 changes: 2 additions & 2 deletions src/components/page-details.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React from 'react';
import {Link, Redirect} from 'react-router-dom';
import WebMonitoringDb from '../services/web-monitoring-db';
import ChangeView from './change-view';
import Loading from './loading'

/**
* @typedef {Object} PageDetailsProps
Expand Down Expand Up @@ -70,9 +71,8 @@ export default class PageDetails extends React.Component {
}

render () {
// TODO: should factor out a loading view
if (!(this.state.page)) {
return <div>Loading</div>;
return (<Loading />);
}

const page = this.state.page;
Expand Down
3 changes: 2 additions & 1 deletion src/components/page-list.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import Loading from './loading'

/**
* These props also inherit from React Router's RouteComponent props
Expand All @@ -16,7 +17,7 @@ import React from 'react';
export default class PageList extends React.Component {
render () {
if (!this.props.pages) {
return <div>Loading</div>;
return (<Loading />);
}

return (
Expand Down
38 changes: 18 additions & 20 deletions src/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -297,30 +297,21 @@ iframe {
width: 100%;
}

/* ===== Progress Bar ===== */
.progress {
width: 100%;
}

.progress .progress-bar.active {
font-weight: 700;
animation: progress-bar-stripes .5s linear infinite;
}

/* ===== Progress bar ===== */
.dotdotdot:after {
font-weight: 300;
content: '...';
display: inline-block;
width: 20px;
text-align: left;
animation: dotdotdot 1.5s linear infinite;
font-weight: 300;
content: '...';
display: inline-block;
width: 20px;
text-align: left;
animation: dotdotdot 1.5s linear infinite;
}

@keyframes dotdotdot {
0% { content: '...'; }
25% { content: ''; }
50% { content: '.'; }
75% { content: '..'; }
0% { content: '...'; }
25% { content: ''; }
50% { content: '.'; }
75% { content: '..'; }
}

/* ===== Login Form ===== */
Expand All @@ -345,3 +336,10 @@ iframe {
.login-form__footer {
text-align: right;
}

.loading {
background-position-x: center;
height: 70px;
background-image: url(../img/infinity-loader.svg);
background-repeat: no-repeat;
}
5 changes: 5 additions & 0 deletions src/img/infinity-loader.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 1 addition & 11 deletions views/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,7 @@
<script src="https://use.fontawesome.com/2155f7b139.js"></script>
</head>
<body id="bootstrap-override">
<div id="web-monitoring-ui-root">
<div class="row">
<div class="col-md-12">
<div class="progress active progress-striped">
<div class="progress-bar progress-success" style="width:100%" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="100">
<span>Please wait<span class="dotdotdot"></span></span>
</div>
</div>
</div>
</div>
</div>
<div id="web-monitoring-ui-root"></div>

<script type="text/javascript" src="/bundle.js"></script>
</body>
Expand Down

0 comments on commit 18fd340

Please sign in to comment.