Skip to content

Commit 2624cf6

Browse files
authored
Merge pull request AgileVentures#163 from nataliyah123/107-separate-component-for-videos
separate component for videos
2 parents a21dc49 + 4d0b79c commit 2624cf6

File tree

4 files changed

+36
-57
lines changed

4 files changed

+36
-57
lines changed

src/components/EventSummary.js

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { Fragment } from 'react'
2-
import { Header, Segment, Grid, Embed, Image, Icon } from 'semantic-ui-react'
2+
import { Header, Segment, Grid, Image, Icon } from 'semantic-ui-react'
33
import CustomRingLoader from './CustomRingLoader'
4+
import Videos from './Videos'
45
import ReactHtmlParser from 'react-html-parser'
56
import moment from 'moment-timezone'
67

@@ -61,24 +62,7 @@ const EventSummary = props => {
6162
</Grid>
6263
</Segment>
6364
</Grid.Column>
64-
<Grid.Column width={4} className='event-info-videos'>
65-
{event.videos ? event.videos
66-
.filter(video => video.yt_video_id !== null)
67-
.map(video => (
68-
<Fragment key={video.id}>
69-
<Embed
70-
id={video.yt_video_id}
71-
placeholder={
72-
'https://img.youtube.com/vi/' +
73-
video.yt_video_id +
74-
'/3.jpg'
75-
}
76-
source='youtube'
77-
/>
78-
<p>{video.title}</p>
79-
</Fragment>
80-
)) : null}
81-
</Grid.Column>
65+
<Videos name={event} id='event-info-videos' />
8266
</Grid>
8367
</Fragment>
8468
)

src/components/ProjectSummary.js

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { Fragment } from 'react'
2-
import { Header, Image, Grid, Card, Icon, Segment, Embed } from 'semantic-ui-react'
2+
import { Header, Image, Grid, Card, Icon, Segment } from 'semantic-ui-react'
33
import CustomRingLoader from './CustomRingLoader'
4+
import Videos from './Videos'
45
import { Link } from 'react-router-dom'
56
import '../assets/ProjectSummary.css'
67

@@ -110,24 +111,7 @@ const ProjectSummary = props => {
110111
</Grid>
111112
</Fragment>
112113
</Grid.Column>
113-
<Grid.Column width={4} className='project-info-videos'>
114-
{project.videos
115-
.filter(video => video.yt_video_id !== null)
116-
.map(video => (
117-
<Fragment key={video.id}>
118-
<Embed
119-
id={video.yt_video_id}
120-
placeholder={
121-
'https://img.youtube.com/vi/' +
122-
video.yt_video_id +
123-
'/3.jpg'
124-
}
125-
source='youtube'
126-
/>
127-
<p>{video.title}</p>
128-
</Fragment>
129-
))}
130-
</Grid.Column>
114+
<Videos name={project} id='project-info-videos' />
131115
</Grid>
132116
)
133117
} else {

src/components/UserSummary.js

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { Fragment } from 'react'
2-
import { Card, Image, Grid, Label, Tab, Embed, Icon } from 'semantic-ui-react'
2+
import { Card, Image, Grid, Label, Tab, Icon } from 'semantic-ui-react'
33
import CustomRingLoader from './CustomRingLoader'
4+
import Videos from './Videos'
45
import moment from 'moment'
56
import '../assets/UserSummary.css'
67

@@ -221,24 +222,7 @@ const UserSummary = props => {
221222
className='user-profile-tabs'
222223
/>
223224
</Grid.Column>
224-
<Grid.Column width={4} className='user-profile-videos'>
225-
{user.videos
226-
.filter(video => video.yt_video_id !== null)
227-
.map(video => (
228-
<Fragment key={video.id}>
229-
<Embed
230-
id={video.yt_video_id}
231-
placeholder={
232-
'https://img.youtube.com/vi/' +
233-
video.yt_video_id +
234-
'/3.jpg'
235-
}
236-
source='youtube'
237-
/>
238-
<p>{video.title}</p>
239-
</Fragment>
240-
))}
241-
</Grid.Column>
225+
<Videos name={user} id='user-profile-videos' />
242226
</Grid.Row>
243227
</Grid>
244228
</Fragment>

src/components/Videos.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React, { Fragment } from 'react'
2+
import { Grid, Embed } from 'semantic-ui-react'
3+
4+
const Videos = (props) => {
5+
return (
6+
<Grid.Column width={4} className={props.id}>
7+
{props.name.videos
8+
.filter(video => video.yt_video_id !== null)
9+
.map(video => (
10+
<Fragment key={video.id}>
11+
<Embed
12+
id={video.yt_video_id}
13+
placeholder={
14+
'https://img.youtube.com/vi/' +
15+
video.yt_video_id +
16+
'/3.jpg'
17+
}
18+
source='youtube'
19+
/>
20+
<p>{video.title}</p>
21+
</Fragment>
22+
))}
23+
24+
</Grid.Column>
25+
)
26+
}
27+
export default Videos

0 commit comments

Comments
 (0)