Skip to content

Commit 710fb6b

Browse files
committed
prop-types
1 parent 4f244e0 commit 710fb6b

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"eslint-plugin-import": "^2.18.0",
1919
"eslint-plugin-jsx-a11y": "^6.2.3",
2020
"eslint-plugin-react": "^7.14.2",
21+
"prop-types": "^15.7.2",
2122
"react": "^16.8.6",
2223
"react-dom": "^16.8.6"
2324
},

src/components/CarouselItem.jsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import PropTypes from 'prop-types';
23
import '../assets/styles/components/CarouselItem.scss';
34
import playIcon from '../assets/static/play-icon.png';
45
import plusIcon from '../assets/static/plus-icon.png';
@@ -19,4 +20,12 @@ const CarouselItem = ({ cover, title, year, contentRating, duration }) => (
1920
</div>
2021
);
2122

23+
CarouselItem.propTypes = {
24+
cover: PropTypes.string,
25+
title: PropTypes.string,
26+
year: PropTypes.number,
27+
contentRating: PropTypes.string,
28+
duration: PropTypes.number,
29+
}
30+
2231
export default CarouselItem;

src/containers/App.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,29 @@ const App = () => {
1616
<div className="App">
1717
<Header />
1818
<Search />
19-
2019
{initialState.mylist.length > 0 &&
2120
<Categories title="Mi Lista">
2221
<Carousel>
23-
<CarouselItem />
22+
{initialState.mylist.map(item =>
23+
<CarouselItem key={item.id} {...item} />
24+
)}
2425
</Carousel>
2526
</Categories>
2627
}
27-
2828
<Categories title="Tendencias">
2929
<Carousel>
3030
{initialState.trends.map(item =>
3131
<CarouselItem key={item.id} {...item} />
3232
)}
3333
</Carousel>
3434
</Categories>
35-
3635
<Categories title="Originales de Platzi Video">
3736
<Carousel>
38-
<CarouselItem />
37+
{initialState.originals.map(item =>
38+
<CarouselItem key={item.id} {...item} />
39+
)}
3940
</Carousel>
4041
</Categories>
41-
4242
<Footer />
4343
</div>
4444
);

0 commit comments

Comments
 (0)