File tree Expand file tree Collapse file tree 10 files changed +117
-65
lines changed
Expand file tree Collapse file tree 10 files changed +117
-65
lines changed Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import VideoMetas from './VideoMetas.js' ;
3+
4+ export const Video = ( { metas, picture, title } ) => (
5+ < div className = "video" >
6+ < img
7+ src = { picture }
8+ alt = { title }
9+ />
10+ < div className = "infos" >
11+ < h2 className = "title" > { title } </ h2 >
12+ < VideoMetas
13+ duration = { metas . duration }
14+ views = { metas . views }
15+ />
16+ </ div >
17+ </ div >
18+ ) ;
19+
20+ export default Video ;
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import Video from './Video' ;
3+
4+ export const VideoList = ( { videos } ) => (
5+ < div className = "videos-list" >
6+ { videos . map ( video => (
7+ < Video
8+ key = { video . title }
9+ title = { video . title }
10+ metas = { video . metas }
11+ picture = { video . picture }
12+ />
13+ ) ) }
14+ </ div >
15+ ) ;
16+
17+ export default VideoList ;
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+
3+ const Metas = ( { duration, views } ) => (
4+ < div className = "video-metas" >
5+ < div className = "duration" >
6+ { duration } minute{ duration > 1 ? 's' : '' }
7+ </ div >
8+ < div className = "views" >
9+ { views } vue{ views > 1 ? 's' : '' }
10+ </ div >
11+ </ div >
12+ ) ;
13+
14+ export default Metas ;
Original file line number Diff line number Diff line change 1+ export default [
2+ {
3+ title : "Une Nuit à Berlin" ,
4+ picture : "http://lorempixel.com/800/450/nightlife/7/" ,
5+ metas : {
6+ views : 11530 ,
7+ duration : 92 ,
8+ }
9+ } ,
10+ {
11+ title : "Touaregs des temps modernes" ,
12+ picture : "http://lorempixel.com/800/450/people/7/" ,
13+ metas : {
14+ views : 49520 ,
15+ duration : 123 ,
16+ } ,
17+ } ,
18+ {
19+ title : "Géologie du Cétacé" ,
20+ picture : "http://lorempixel.com/800/450/nature/3/" ,
21+ metas : {
22+ views : 8953 ,
23+ duration : 24 ,
24+ } ,
25+ }
26+ ] ;
Original file line number Diff line number Diff line change 11body {
2- margin : 0 ;
3- padding : 0 ;
4- font-family : sans-serif;
2+ font-size : 18px ;
3+ padding : 1rem ;
4+ font-family : Arial;
5+ }
6+
7+ .videos-list {
8+ max-width : 600px ;
9+ }
10+
11+ .video {
12+ display : flex;
13+ align-items : center;
14+ height : 180px ;
15+ margin-bottom : 1rem ;
16+ }
17+
18+ .video .title {
19+ margin : 0 0 0.5rem 0 ;
20+ }
21+
22+ .video img {
23+ width : 300px ;
24+ float : left;
25+ margin-right : 1rem ;
26+ }
27+
28+ .video-metas {
29+ display : flex;
30+ }
31+
32+ .video-metas .duration {
33+ flex : 1 0 0 ;
34+ }
35+
36+ .video-metas .views {
37+ flex : 1 0 0 ;
538}
Original file line number Diff line number Diff line change 11import React from 'react' ;
22import ReactDOM from 'react-dom' ;
3- import App from './App' ;
43import './index.css' ;
54
5+ import videos from './data' ;
6+ import VideoList from './VideoList' ;
7+
68ReactDOM . render (
7- < App /> ,
9+ < VideoList videos = { videos } /> ,
810 document . getElementById ( 'root' )
911) ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments