Skip to content

Commit 4d24a29

Browse files
Finished Movie component and corrected errors
1 parent 1e51c50 commit 4d24a29

File tree

4 files changed

+40
-14
lines changed

4 files changed

+40
-14
lines changed

src/components/Movie/Movie.js

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,33 @@ export default class Movie extends Component {
5656
render() {
5757
return (
5858
<div className="rmdb-movie">
59-
<Navigation />
60-
<MovieInfo />
61-
<MovieInfoBar />
62-
{/* <FourColGrid /> */}
63-
<Spinner />
59+
{this.state.movie ? (
60+
<div>
61+
<Navigation movie={this.props.location.movieName} />
62+
<MovieInfo
63+
movie={this.state.movie}
64+
directors={this.state.directors}
65+
/>
66+
<MovieInfoBar
67+
time={this.state.movie.runtime}
68+
budget={this.state.movie.budget}
69+
revenue={this.state.movie.revenue}
70+
/>
71+
</div>
72+
) : null}
73+
{this.state.actors ? (
74+
<div className="rmdb-movie-grid">
75+
<FourColGrid header={"Actors"}>
76+
{this.state.actors.map((element, i) => {
77+
return <Actor key={i} actor={element} />;
78+
})}
79+
</FourColGrid>
80+
</div>
81+
) : null}
82+
{!this.state.actors && !this.state.loading ? (
83+
<h1>No Movie Found</h1>
84+
) : null}
85+
{this.state.loading ? <Spinner /> : null}}
6486
</div>
6587
);
6688
}

src/components/elements/MovieInfo/MovieInfo.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,15 @@ export default function MovieInfo(props) {
4444
<p className="rmdb-score">{props.movie.vote_average}</p>
4545
</div>
4646
{props.directors.length > 1 ? <h3>DIRECTORS</h3> : <h3>DIRECTOR</h3>}
47-
{props.directors.map((element,1)=> {
48-
return <p key={i} className="rmdb-director">{element.name}</p>
47+
{props.directors.map((element, i) => {
48+
return (
49+
<p key={i} className="rmdb-director">
50+
{element.name}
51+
</p>
52+
);
4953
})}
5054
</div>
51-
<FontAwesome className='fa-film' name='file' size="5x" />
55+
<FontAwesome className="fa-film" name="film" size="5x" />
5256
</div>
5357
</div>
5458
);

src/components/elements/MovieInfoBar/MovieInfoBar.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ export default function MovieInfoBar(props) {
77
return (
88
<div className="rmdb-movieinfobar">
99
<div className="rmdb-movieinfobar-content">
10-
<div className="rmdb-movieinfobar-col">
10+
<div className="rmdb-movieinfobar-content-col">
1111
<FontAwesome className="fa-time" name="clock-o" size="2x" />
1212
<span className="rmdb-movieinfobar-info">
1313
Running time: {calcTime(props.time)}
1414
</span>
1515
</div>
16-
<div className="rmdb-movieinfobar-col">
16+
<div className="rmdb-movieinfobar-content-col">
1717
<FontAwesome className="fa-budget" name="money" size="2x" />
1818
<span className="rmdb-movieinfobar-info">
1919
Budget : {convertMoney(props.budget)}
2020
</span>
2121
</div>
22-
<div className="rmdb-movieinfobar-col">
22+
<div className="rmdb-movieinfobar-content-col">
2323
<FontAwesome className="fa-revenue" name="ticket" size="2x" />
2424
<span className="rmdb-movieinfobar-info">
2525
Revenue : {convertMoney(props.revenue)}

src/components/elements/Navigation/Navigation.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import React from "react";
22
import { Link } from "react-router-dom";
33
import "./Navigation.css";
44

5-
export default function Navigation() {
5+
export default function Navigation(props) {
66
return (
77
<div className="rmdb-navigation">
88
<div className="rmdb-navigation-content">
99
<Link to="/">
1010
<p>Home</p>
11+
<p>/</p>
12+
<p>{props.movie}</p>
1113
</Link>
12-
<p>/</p>
13-
<p>{props.movie}</p>
1414
</div>
1515
</div>
1616
);

0 commit comments

Comments
 (0)