Skip to content

Commit

Permalink
Added help text to loading page (#197)
Browse files Browse the repository at this point in the history
Added help text to loading page if loading takes more than 2 seconds. Allows users to submit issues to Github through a link on the loading page.
  • Loading branch information
rzlien authored Feb 21, 2020
1 parent 8314b8b commit 3dd58ef
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 6 deletions.
46 changes: 40 additions & 6 deletions src/components/common/LoadingPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,45 @@ import "styles/Loading.scss";
textPadding: string representing padding to the left of the text, i.e. distance from the img (give px units)
*/

const Loading = props => (
<div className="Loading">
<div className="Loading-title">Loading</div>
<RingLoader color={"#171124"} size={250} loading={true} />
</div>
);
class Loading extends React.Component {
constructor(props) {
super(props);
this.state = {
showText: false,
timer: 0,
};
}
componentDidMount = () => {
this.setState.timer = setTimeout(() => {
this.setState({ showText: true });
}, 2000);
};

componentWillUnmount = () => {
clearTimeout(this.setState.timer);
};

render = () => {
return (
<div className="Loading">
<div className="Loading-title">Loading</div>
<RingLoader color={"#171124"} size={250} loading={true} />
{this.state.showText && (
<p className="Loading-page-text" style={{ color: "white" }}>
Looks like loading is taking a bit long! If it takes too long, submit an issue on{" "}
<span> </span>
<a
href="https://github.com/uclaacm/TeachLAFrontend/issues"
className="Loading-link-text"
>
Github
</a>
.
</p>
)}
</div>
);
};
}

export default Loading;
16 changes: 16 additions & 0 deletions src/styles/Loading.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,19 @@
font-family: $font-family-heading;
color: $off-white;
}

.Loading-page-text {
color: $off-white;
margin-top: 3rem;
margin-left: 2rem;
margin-right: 2rem;
}

.Loading-link-text {
color: $off-white;
text-decoration: underline;
}

.Loading-link-text:hover {
color: $teachla-green;
}

0 comments on commit 3dd58ef

Please sign in to comment.