-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More inför please see document: docs/Modules.md#Embed
- Loading branch information
Showing
4 changed files
with
193 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
import React from 'react'; | ||
|
||
import filter from '../filter'; | ||
|
||
const defaultClassName = 'ui embed'; | ||
|
||
const Basic = React.createClass({ | ||
|
||
render: function () { | ||
|
||
const { props: { children, placeholder, source, sourceId, url, icon, ...other } } = this; | ||
|
||
return ( | ||
<div {...other} | ||
data-source={source} | ||
data-id={sourceId} | ||
data-placeholder={placeholder} | ||
data-url={url} | ||
data-icon={icon} | ||
ref="embed"> | ||
{children} | ||
</div> | ||
); | ||
}, | ||
|
||
componentDidMount: function () { | ||
|
||
const { props: { init = false } } = this; | ||
|
||
if (init === false) { | ||
return; | ||
} | ||
|
||
if (init === true) { | ||
$(this.refs.embed).embed(); | ||
} else { | ||
$(this.refs.embed).embed(init); | ||
} | ||
} | ||
}); | ||
|
||
const Embed = new filter(Basic) | ||
.classGenerator(defaultClassName) | ||
.getComposeComponent(); | ||
|
||
export default Embed; |
Oops, something went wrong.