-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Gil Teitelbaum
committed
Sep 17, 2020
1 parent
d9871bd
commit 61ed1d2
Showing
5 changed files
with
91 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,22 @@ | ||
import React, { Component } from "react"; | ||
import React from "react"; | ||
import { Link } from "react-router-dom"; | ||
|
||
class MoviesTable extends Component { | ||
render() { | ||
const { movies } = this.props; | ||
|
||
return ( | ||
<div className="row"> | ||
{movies.map(movie => ( | ||
<div key={movie.imdbID} className="col-xs-12 col-sm-6 col-md-4 col-lg-3 movieListEntry"> | ||
<Link to={'/movies/' + movie.imdbID}> | ||
<img loading="lazy" onError={this.setDefaultSource} className="movieListImage" src={movie.Poster} alt={"Movie poster for " + movie.Title}></img> | ||
<h4 className="movieListTitle">{movie.Title} {"(" + movie.Year + ")"}</h4> | ||
</Link> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
} | ||
|
||
setDefaultSource(event) { | ||
export default function MoviesTable(props) { | ||
function setDefaultSource(event) { | ||
event.target.src = "../../noimage.png"; | ||
} | ||
} | ||
const { movies } = props; | ||
|
||
export default MoviesTable; | ||
return ( | ||
<div className="row"> | ||
{movies.map(movie => ( | ||
<div key={movie.imdbID} className="col-xs-12 col-sm-6 col-md-4 col-lg-3 movieListEntry"> | ||
<Link to={'/movies/' + movie.imdbID}> | ||
<img loading="lazy" onError={setDefaultSource} className="movieListImage" src={movie.Poster} alt={"Movie poster for " + movie.Title}></img> | ||
<h4 className="movieListTitle">{movie.Title} {"(" + movie.Year + ")"}</h4> | ||
</Link> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters