1
- import _ from 'lodash'
2
1
import cx from 'classnames'
2
+ import _ from 'lodash'
3
3
import React , { PropTypes } from 'react'
4
4
5
5
import {
@@ -12,45 +12,26 @@ import {
12
12
} from '../../lib'
13
13
import Icon from '../../elements/Icon'
14
14
15
- const _meta = {
16
- name : 'Embed' ,
17
- type : META . TYPES . MODULE ,
18
- props : {
19
- aspectRatio : [ '4:3' , '16:9' , '21:9' ] ,
20
- source : [ 'youtube' , 'vimeo' ] ,
21
- } ,
22
- }
23
-
24
15
/**
25
16
* An embed displays content from other websites like YouTube videos or Google Maps.
26
17
*/
27
18
export default class Embed extends Component {
28
- static autoControlledProps = [
29
- 'active' ,
30
- ]
31
-
32
- static defaultProps = {
33
- icon : 'video play' ,
34
- }
35
-
36
- static _meta = _meta
37
-
38
19
static propTypes = {
39
20
/** An element type to render as (string or function). */
40
21
as : customPropTypes . as ,
41
22
42
23
/** An embed can be active. */
43
24
active : PropTypes . bool ,
44
25
45
- /** Setting to true or false will force autoplay. */
26
+ /** An embed can specify an alternative aspect ratio. */
27
+ aspectRatio : PropTypes . oneOf ( [ '4:3' , '16:9' , '21:9' ] ) ,
28
+
29
+ /** Setting to true or false will force autoplay. */
46
30
autoplay : customPropTypes . every ( [
47
31
customPropTypes . demand ( [ 'source' ] ) ,
48
32
PropTypes . bool ,
49
33
] ) ,
50
34
51
- /** An embed can specify an alternative aspect ratio. */
52
- aspectRatio : PropTypes . oneOf ( _meta . props . aspectRatio ) ,
53
-
54
35
/** Whether to show networks branded UI like title cards, or after video calls to action. */
55
36
brandedUI : customPropTypes . every ( [
56
37
customPropTypes . demand ( [ 'source' ] ) ,
@@ -78,15 +59,15 @@ export default class Embed extends Component {
78
59
PropTypes . bool ,
79
60
] ) ,
80
61
62
+ /** Specifies an icon to use with placeholder content. */
63
+ icon : customPropTypes . itemShorthand ,
64
+
81
65
/** Specifies an id for source. */
82
66
id : customPropTypes . every ( [
83
67
customPropTypes . demand ( [ 'source' ] ) ,
84
68
PropTypes . string ,
85
69
] ) ,
86
70
87
- /** Specifies an icon to use with placeholder content. */
88
- icon : customPropTypes . itemShorthand ,
89
-
90
71
/**
91
72
* Сalled on click.
92
73
*
@@ -101,7 +82,7 @@ export default class Embed extends Component {
101
82
/** Specifies a source to use. */
102
83
source : customPropTypes . every ( [
103
84
customPropTypes . disallow ( [ 'sourceUrl' ] ) ,
104
- PropTypes . oneOf ( _meta . props . source ) ,
85
+ PropTypes . oneOf ( [ 'youtube' , 'vimeo' ] ) ,
105
86
] ) ,
106
87
107
88
/** Specifies a url to use for embed. */
@@ -111,6 +92,19 @@ export default class Embed extends Component {
111
92
] ) ,
112
93
}
113
94
95
+ static autoControlledProps = [
96
+ 'active' ,
97
+ ]
98
+
99
+ static defaultProps = {
100
+ icon : 'video play' ,
101
+ }
102
+
103
+ static _meta = {
104
+ name : 'Embed' ,
105
+ type : META . TYPES . MODULE ,
106
+ }
107
+
114
108
state = { }
115
109
116
110
getSrc ( ) {
0 commit comments