|
1 |
| -import React from 'react'; |
2 |
| -import PropTypes from 'prop-types'; |
3 |
| -import classNames from 'classnames'; |
4 |
| -import {mapToCssModules, tagPropType} from './Shared/helper.js'; |
5 |
| -import CEmbedObject from './CEmbedObject'; |
| 1 | +import React from 'react' |
| 2 | +import PropTypes from 'prop-types' |
| 3 | +import classNames from 'classnames' |
| 4 | +import { mapToCssModules, tagPropType } from './Shared/helper.js' |
6 | 5 |
|
7 | 6 | //component - CoreUI / CEmbed
|
8 | 7 |
|
9 |
| -const CEmbed = props=>{ |
| 8 | +const CEmbed = props => { |
10 | 9 |
|
11 | 10 | const {
|
12 | 11 | tag: Tag,
|
13 | 12 | className,
|
14 | 13 | cssModule,
|
15 |
| - custom, |
16 | 14 | innerRef,
|
17 | 15 | //
|
18 | 16 | ratio,
|
19 |
| - type, |
20 |
| - src, |
21 |
| - objectClassName, |
22 |
| - objectProps, |
23 | 17 | ...attributes
|
24 |
| - } = props; |
| 18 | + } = props |
25 | 19 |
|
26 | 20 | //render
|
27 | 21 |
|
28 | 22 | const classes = mapToCssModules(classNames(
|
29 |
| - className, |
30 |
| - ratio ? `embed-responsive-${ratio}` : null, |
31 |
| - 'embed-responsive' |
32 |
| - ), cssModule); |
33 |
| - |
34 |
| - const objectClasses = mapToCssModules(classNames( |
35 |
| - objectClassName |
36 |
| - ), cssModule); |
37 |
| - |
38 |
| - if (!custom){ |
39 |
| - return ( |
40 |
| - <Tag className={classes} {...attributes} ref={innerRef}> |
41 |
| - <CEmbedObject {...objectProps} className={objectClasses} type={type} src={src} /> |
42 |
| - </Tag> |
43 |
| - ); |
44 |
| - } |
| 23 | + className, 'embed-responsive', `embed-responsive-${ratio}` |
| 24 | + ), cssModule) |
45 | 25 |
|
46 | 26 | return (
|
47 |
| - <Tag className={classes} {...attributes} ref={innerRef} /> |
48 |
| - ); |
| 27 | + <Tag className={classes} {...attributes} ref={innerRef}/> |
| 28 | + ) |
49 | 29 |
|
50 | 30 | }
|
51 | 31 |
|
52 | 32 | CEmbed.propTypes = {
|
53 | 33 | tag: tagPropType,
|
54 | 34 | className: PropTypes.string,
|
55 | 35 | cssModule: PropTypes.object,
|
56 |
| - custom: PropTypes.bool, |
57 | 36 | //
|
58 | 37 | innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),
|
59 |
| - ratio: PropTypes.string, |
60 |
| - objectClassName: PropTypes.string, |
61 |
| - objectProps: PropTypes.object, |
62 |
| - /// |
63 |
| - type: PropTypes.string, |
64 |
| - src: PropTypes.string, |
| 38 | + ratio: PropTypes.oneOf(['21by9', '16by9', '4by3', '1by1']), |
65 | 39 | };
|
66 | 40 |
|
67 | 41 | CEmbed.defaultProps = {
|
68 |
| - tag: 'span', |
69 |
| - ratio: '16by9', |
70 |
| - type: 'iframe', |
71 |
| -}; |
| 42 | + tag: 'div', |
| 43 | + ratio: '16by9' |
| 44 | +} |
72 | 45 |
|
73 |
| -export default CEmbed; |
| 46 | +export default CEmbed |
0 commit comments