forked from jestjs/jest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvideos.js
More file actions
99 lines (92 loc) · 2.64 KB
/
videos.js
File metadata and controls
99 lines (92 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
const React = require('react');
const {Container, MarkdownBlock} = require('../../core/CompLibrary.js');
const {translate} = require('../../server/translate.js');
const siteConfig = require(process.cwd() + '/siteConfig.js');
class Video extends React.PureComponent {
render() {
const {url, type} = this.props;
switch (type) {
case siteConfig.videoTypes.YOUTUBE: {
return (
<iframe
width="560"
height="315"
src={url}
frameBorder="0"
allowFullScreen
/>
);
}
case siteConfig.videoTypes.IFRAME: {
return <iframe src={url} />;
}
default: {
return <iframe src={url} />;
}
}
}
}
class Videos extends React.Component {
render() {
const showcase = siteConfig.videos.map(
({title, description, type, url}, index) => {
const textMarkup = (
<div className="blockContent">
<h2>{title}</h2>
<div>
<MarkdownBlock>{description}</MarkdownBlock>
</div>
</div>
);
const videoMarkup = (
<div className="video">
<Video url={url} type={type} />
</div>
);
return (
<Container key={url} padding={['bottom', 'top']}>
<a className="hash-link" href={`#${title}`} />
{index % 2 === 0 ? (
<div className="blockElement imageAlignSide threeByGridBlock">
{videoMarkup}
{textMarkup}
</div>
) : (
<div className="blockElement imageAlignSide threeByGridBlock">
{textMarkup}
{videoMarkup}
</div>
)}
</Container>
);
}
);
return (
<div className="mainContainer">
<Container padding={['bottom', 'top']}>
<div className="showcaseSection">
<div className="prose">
<h1>
<translate>Talks & Videos</translate>
</h1>
<p>
<translate>
We understand that reading through docs can be boring
sometimes. Here is a community curated list of talks & videos
around Jest.
</translate>
</p>
</div>
</div>
{showcase}
<div style={{textAlign: 'center'}}>
<a href={siteConfig.siteConfigUrl} className="button">
<translate>Add your favorite talk</translate>
</a>
</div>
</Container>
</div>
);
}
}
module.exports = Videos;