Created
February 12, 2019 20:23
-
-
Save bietkul/31fb6baf27934350dea84751af92c877 to your computer and use it in GitHub Desktop.
Product card component
This file contains hidden or 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
| import React from 'react'; | |
| import PropTypes from 'prop-types'; | |
| const ProductCard = ({ | |
| id, | |
| originalTitle, | |
| genresData, | |
| releaseYear, | |
| posterPath, | |
| overview, | |
| price, | |
| voteAverage, | |
| }) => ( | |
| <div key={id}> | |
| <div> | |
| <img src={`https://image.tmdb.org/t/p/w500${posterPath}`} alt={originalTitle} /> | |
| <div> | |
| <div> | |
| <h2>{originalTitle}</h2> | |
| <h3>{`${releaseYear} | ${genresData.toString().replace(/,/g, ', ')}`}</h3> | |
| <div> | |
| Rating: | |
| {' '} | |
| <strong>{voteAverage}</strong> | |
| </div> | |
| <div> | |
| {overview} | |
| </div> | |
| </div> | |
| <div> | |
| <h2>{`$${price}`}</h2> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| ); | |
| ProductCard.propTypes = { | |
| id: PropTypes.number, | |
| originalTitle: PropTypes.string, | |
| genresData: PropTypes.oneOfType([PropTypes.array, PropTypes.string]), | |
| releaseYear: PropTypes.string, | |
| posterPath: PropTypes.string, | |
| overview: PropTypes.string, | |
| price: PropTypes.number, | |
| voteAverage: PropTypes.number, | |
| }; | |
| export default ProductCard; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment