implemented 404 page styles

This commit is contained in:
andres alcocer
2020-07-10 19:13:11 -04:00
parent df9a71c1d4
commit 0daf75f804
4 changed files with 77 additions and 6 deletions

View File

@@ -83,7 +83,8 @@ class Navbar extends Component {
await this.setState({ movieList: movieRows });
this.props.history.push({
pathname: '/search',
movieRows: this.state.movieList
movieRows: this.state.movieList,
userInput: searchItem
});
}

View File

@@ -1,11 +1,55 @@
import React, { Component } from 'react';
export default class Search extends Component {
constructor(props) {
super(props)
this.state = {
movies: []
}
}
componentDidMount = async () => {
const { movieRows } = this.props.history.location;
if (movieRows)
await this.setState({ movies: movieRows });
}
componentDidUpdate = async (prevProps) => {
if (
prevProps.location.movieRows.length !==
this.props.location.movieRows.length
) {
await this.setState({ movies: this.props.location.movieRows });
}
}
render() {
const { movies } = this.state
const { userInput } = this.props.location
return (
<div className="search-container">
{this.props.history.location.movieRows}
</div>
<>
{
this.state.movies.length > 0 ? (
<div className="search-container">
{this.state.movies}
</div>
) : (
<div className="no-results">
<div className="no-results__text">
<p>Your search for "{userInput}" did not have any matches.</p>
<p>Suggestions:</p>
<ul>
<li>Try different keywords</li>
<li>Looking for a movie or TV show?</li>
<li>Try using a movie, TV show title, an actor or director</li>
<li>Try a genre, like comedy, romance, sports, or drama</li>
</ul>
</div>
</div>
)
}
</>
);
}
}

View File

@@ -14,10 +14,8 @@ const createStoreWithMiddleware = applyMiddleware(promise)(createStore);
// TODO
// - fix styling issue
// - implemented debouncing
// - implement carousel
// - fix modal backdrop bug
// - add routing and 404 page
const app = (
<Provider store={createStoreWithMiddleware(reducers)}>
<App />

View File

@@ -8,4 +8,32 @@
height: 150%;
padding-bottom: 10rem;
padding-left: 4rem;
}
.no-results {
display: flex;
justify-content: center;
align-content: center;
color: #c5c5c5;
height: 100%;
padding-top: 25rem;
&__text {
font-size: 1.6rem;
&>* {
padding-bottom: 1.8rem;
}
&>ul {
// color: red;
padding-left: 6.5rem;
list-style: disc;
&>* {
padding-bottom: 0.2rem;
}
}
}
}