Skip to content

Commit

Permalink
Merge pull request #25 from larryschirmer/add-loading-modal
Browse files Browse the repository at this point in the history
Add loading modal
  • Loading branch information
amcquade authored Nov 15, 2019
2 parents b756ddc + 5202bfa commit f1ffd08
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 12 deletions.
4 changes: 0 additions & 4 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
text-align: center;
}

.App-logo {
height: 40vmin;
}

.App-header {
background-color: #282c34;
min-height: 70px;
Expand Down
11 changes: 3 additions & 8 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import React, { Component } from "react";
import "./App.css";
import EpisodeList from "./components/EpisodeList";
import UserForm from "./components/UserForm";
import logo from "./logo.svg";
import LoadingStatus from "./components/LoadingStatus";

import {
Button,
Dialog,
Expand Down Expand Up @@ -98,13 +99,7 @@ class App extends Component {
onClick={() => this.setState({ fetching: true })}
/>
{this.state.error ? this.renderAlert() : <div />}
{!this.state.fetching ? (
<p>Please enter an RSS feed</p>
) : (
<div>
<img src={logo} className="App-logo" alt="App Logo" />
</div>
)}
<LoadingStatus fetching={this.state.fetching} />
<EpisodeList
episodes={this.state.episodes}
program_title={this.state.program_title}
Expand Down
54 changes: 54 additions & 0 deletions src/components/LoadingStatus.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import React from "react";

import logo from "../logo.svg";

const LoadingStatus = ({ fetching }) => {
const styles = {
statusContainer: {
height: "50px",
display: "flex",
justifyContent: "center",
alignItems: "center"
},
modalContainer: {
width: "100vw",
height: "100vh",
background: "rgba(0, 0, 0, 0.25)",
position: "fixed",
top: 0,
left: 0,
display: "flex",
justifyContent: "center",
alignItems: "center",
zIndex: 1
},
modal: {
width: "250px",
height: "200px",
background: "white",
borderRadius: "4px",
display: "flex",
justifyContent: "center",
alignItems: "center"
},
statusText: {
margin: 0
}
};

return (
<div style={styles.statusContainer}>
{fetching ? (
<div style={styles.modalContainer}>
<div style={styles.modal}>
<img src={logo} alt="loading animation" />
</div>
</div>
) : (
<p style={styles.statusText}>Please enter an RSS feed</p>
)}
</div>
);
};

export default LoadingStatus;

0 comments on commit f1ffd08

Please sign in to comment.