react-modal-video
Advanced tools
Comparing version 1.2.5 to 1.2.6
{ | ||
"name": "react-modal-video", | ||
"version": "1.2.5", | ||
"version": "1.2.6", | ||
"main": "lib/index.js", | ||
@@ -31,3 +31,3 @@ "description": "Modal Video Viewer", | ||
"browserify": "^13.1.1", | ||
"eslint": "^3.13.0", | ||
"eslint": "^4.18.2", | ||
"eslint-config-airbnb": "^13.0.0", | ||
@@ -34,0 +34,0 @@ "eslint-config-airbnb-base": "^11.0.1", |
@@ -29,3 +29,28 @@ # react-modal-video | ||
``` | ||
### Functional Implementation with Hooks | ||
```jsx | ||
import React,{useState} from 'react' | ||
import ReactDOM from 'react-dom' | ||
import ModalVideo from 'react-modal-video' | ||
const App = () => { | ||
const [isOpen, setOpen] = useState(false) | ||
return ( | ||
<React.Fragment> | ||
<ModalVideo channel='youtube' autoplay isOpen={isOpen} videoId="L61p2uyiMSo" onClose={() => setOpen(false)} /> | ||
<button className="btn-primary" onClick={()=> setOpen(true)}>VIEW DEMO</button> | ||
</React.Fragment> | ||
) | ||
} | ||
ReactDOM.render( | ||
<App />, | ||
document.getElementById('root') | ||
) | ||
``` | ||
### Class Implementation | ||
change "isOpen" property to open and close the modal-video | ||
@@ -54,6 +79,6 @@ | ||
return ( | ||
<div> | ||
<React.Fragment> | ||
<ModalVideo channel='youtube' isOpen={this.state.isOpen} videoId='L61p2uyiMSo' onClose={() => this.setState({isOpen: false})} /> | ||
<button onClick={this.openModal}>Open</button> | ||
</div> | ||
</React.Fragment> | ||
) | ||
@@ -60,0 +85,0 @@ } |
@@ -24,3 +24,3 @@ import React from 'react' | ||
return ( | ||
<div> | ||
<React.Fragment> | ||
<ModalVideo channel='youtube' isOpen={this.state.isOpen} videoId='L61p2uyiMSo' youtube={{mute:1,autoplay:1}} onClose={() => this.setState({isOpen: false})} /> | ||
@@ -45,3 +45,3 @@ <button onClick={this.openModal}>Open YouTube</button> | ||
</div> | ||
</React.Fragment> | ||
) | ||
@@ -48,0 +48,0 @@ } |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1257022
324