-
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* CSS text-ellipsis of item summary * No need to wrap event props * Fix summary test * CSS solution for torrent health * Use uncontrolled tooltip * Use uncontrolled dropdown * Read playback information from state directly * description component * Remove unused state vars * use data-e2e attribute * Capitalize react component filename
- Loading branch information
1 parent
df08fe9
commit 320eded
Showing
6 changed files
with
190 additions
and
228 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
import React from 'react'; | ||
import classNames from 'classnames'; | ||
import { Row, Col, UncontrolledTooltip } from 'reactstrap'; | ||
|
||
import Rating from '../card/Rating'; | ||
|
||
type Props = { | ||
title: string, | ||
runtime: Object, | ||
genres: Array, | ||
summary: string, | ||
rating: number, | ||
onTrailerClick: Function, | ||
year: number, | ||
torrentHealth: string, | ||
certification: string, | ||
nrSeeders: number, | ||
trailer: string | ||
}; | ||
|
||
export default function Description({ | ||
title, | ||
runtime, | ||
genres, | ||
summary, | ||
rating = 'n/a', | ||
onTrailerClick, | ||
year, | ||
torrentHealth, | ||
certification, | ||
nrSeeders = 0, | ||
trailer | ||
}: Props) { | ||
const torrentHealthClassName = classNames([ | ||
'torrent__health', | ||
{ [`torrent__health--${torrentHealth}`]: torrentHealth } | ||
]); | ||
|
||
return ( | ||
<Col sm="6" className="Movie"> | ||
<h1 className="row-margin" id="title"> | ||
{title} | ||
</h1> | ||
<Row> | ||
{(runtime.hours || runtime.minutes) && ( | ||
<span className="col-sm-3" id="runtime"> | ||
<h6> | ||
{runtime.hours ? `${runtime.hours} hrs ` : ''} | ||
{runtime.minutes ? `${runtime.minutes} min` : ''} | ||
</h6> | ||
</span> | ||
)} | ||
<span className="col-sm-9" id="genres"> | ||
{genres && <h6>{genres.join(', ')}</h6>} | ||
</span> | ||
</Row> | ||
<h6 data-e2e="summary" className="row-margin item__summary"> | ||
{summary} | ||
</h6> | ||
<Row className="row-margin row-center Item--details"> | ||
{rating && typeof rating === 'number' && ( | ||
<Col sm="5"> | ||
<Rating | ||
emptyStarColor="rgba(255, 255, 255, 0.2)" | ||
starColor="white" | ||
rating={rating} | ||
/> | ||
</Col> | ||
)} | ||
<Col sm="2"> | ||
<span data-e2e="item-year">{year}</span> | ||
</Col> | ||
|
||
{certification && certification !== 'n/a' && ( | ||
<Col sm="3"> | ||
<div className="certification">{certification}</div> | ||
</Col> | ||
)} | ||
|
||
<Col sm="2" className="row-center"> | ||
<i className="ion-md-magnet" /> | ||
<div | ||
id="magnetPopoverOpen" | ||
data-e2e="item-magnet-torrent-health-popover" | ||
className={torrentHealthClassName} | ||
/> | ||
<UncontrolledTooltip placement="top" target="magnetPopoverOpen"> | ||
{nrSeeders} | ||
{' Seeders'} | ||
</UncontrolledTooltip> | ||
</Col> | ||
|
||
{process.env.NODE_ENV === 'test' && trailer !== 'n/a' && ( | ||
<Col sm="3" className="row-center"> | ||
<i | ||
id="trailerPopoverOpen" | ||
data-e2e="item-trailer-button" | ||
className="ion-md-videocam" | ||
onClick={onTrailerClick} | ||
role="presentation" | ||
/> | ||
<UncontrolledTooltip placement="top" target="trailerPopoverOpen"> | ||
Trailer | ||
</UncontrolledTooltip> | ||
</Col> | ||
)} | ||
</Row> | ||
</Col> | ||
); | ||
} |
Oops, something went wrong.