File tree Expand file tree Collapse file tree 3 files changed +27
-24
lines changed Expand file tree Collapse file tree 3 files changed +27
-24
lines changed Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+
3+ export class EllipsisLoading extends React . PureComponent {
4+ state = { dots : 0 } ;
5+ static defaultProps = {
6+ text : 'Loading' ,
7+ animationMs : 400 ,
8+ maxDots : 5
9+ } ;
10+ componentDidMount ( ) {
11+ this . interval = window . setInterval ( ( ) => {
12+ this . setState ( state => {
13+ return { dots : ( state . dots + 1 ) % this . props . maxDots } ;
14+ } ) ;
15+ } , this . props . animationMs ) ;
16+ }
17+ componentWillUnmount ( ) {
18+ window . clearInterval ( this . interval ) ;
19+ }
20+ render ( ) {
21+ let dots = '.' . repeat ( this . state . dots + 1 ) ;
22+ return `${ this . props . text } ${ dots } ` ;
23+ }
24+ }
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import classNames from 'classnames';
77import AutoProgressBar from './AutoProgressBar' ;
88import shortUrls from './shortUrls' ;
99import { withRouter } from './Routes' ;
10+ import { EllipsisLoading } from './Common' ;
1011
1112const BORS_LOGIN = 'bors[bot]' ;
1213
@@ -561,7 +562,7 @@ class Culprits extends React.PureComponent {
561562 < >
562563 < h3 className = "page-header culprits" > Culprits</ h3 >
563564 { error && < div className = "alert alert-danger" > { error . toString ( ) } </ div > }
564- { loading && ' loading culprits...' }
565+ { loading && < EllipsisLoading text = " loading culprits" /> }
565566 { culprits && (
566567 < div className = "culprits" >
567568 { culprits . map ( group => (
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import React from 'react';
22import { withRouter , Link } from 'react-router-dom' ;
33
44import shortUrls from './shortUrls' ;
5+ import { EllipsisLoading } from './Common' ;
56
67export default class SetupPage extends React . Component {
78 render ( ) {
@@ -187,29 +188,6 @@ class PreviousEnvironments extends React.Component {
187188 }
188189}
189190
190- class EllipsisLoading extends React . PureComponent {
191- state = { dots : 0 } ;
192- static defaultProps = {
193- text : 'Loading' ,
194- animationMs : 400 ,
195- maxDots : 5
196- } ;
197- componentDidMount ( ) {
198- this . interval = window . setInterval ( ( ) => {
199- this . setState ( state => {
200- return { dots : ( state . dots + 1 ) % this . props . maxDots } ;
201- } ) ;
202- } , this . props . animationMs ) ;
203- }
204- componentWillUnmount ( ) {
205- window . clearInterval ( this . interval ) ;
206- }
207- render ( ) {
208- let dots = '.' . repeat ( this . state . dots + 1 ) ;
209- return `${ this . props . text } ${ dots } ` ;
210- }
211- }
212-
213191class WhatIsIt extends React . Component {
214192 render ( ) {
215193 return (
You can’t perform that action at this time.
0 commit comments