diff --git a/demo/Demo.react.js b/demo/Demo.react.js index cb70827..c04af85 100644 --- a/demo/Demo.react.js +++ b/demo/Demo.react.js @@ -1,5 +1,5 @@ import React, {Component} from 'react'; -import {ExampleComponent} from '../src'; +import {Player} from '../src'; class Demo extends Component { constructor() { @@ -15,12 +15,8 @@ class Demo extends Component {

dash-player Demo


-

ExampleComponent

- this.setState({value: newProps.value})} - /> +

Player

+
); diff --git a/src/components/ExampleComponent.react.js b/src/components/ExampleComponent.react.js deleted file mode 100644 index 0208e92..0000000 --- a/src/components/ExampleComponent.react.js +++ /dev/null @@ -1,59 +0,0 @@ -import React, {Component} from 'react'; -import PropTypes from 'prop-types'; - -/** - * ExampleComponent is an example component. - * It takes a property, `label`, and - * displays it. - * It renders an input with the property `value` - * which is editable by the user. - */ -export default class ExampleComponent extends Component { - render() { - const {id, label, setProps, value} = this.props; - - return ( -
- ExampleComponent: {label} - { - /* - * Send the new value to the parent component. - * In a Dash app, this will send the data back to the - * Python Dash app server. - */ - if (setProps) { - setProps({ - value: e.target.value - }); - } - }} - /> -
- ); - } -} - -ExampleComponent.propTypes = { - /** - * The ID used to identify this compnent in Dash callbacks - */ - id: PropTypes.string, - - /** - * A label that will be printed when this component is rendered. - */ - label: PropTypes.string.isRequired, - - /** - * The value displayed in the input - */ - value: PropTypes.string, - - /** - * Dash-assigned callback that should be called whenever any of the - * properties change - */ - setProps: PropTypes.func -}; diff --git a/src/components/PlayerComponent.react.js b/src/components/Player.react.js similarity index 94% rename from src/components/PlayerComponent.react.js rename to src/components/Player.react.js index 7176256..679b942 100644 --- a/src/components/PlayerComponent.react.js +++ b/src/components/Player.react.js @@ -7,10 +7,9 @@ import PropTypes from 'prop-types'; * YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia, Mixcloud, * and DailyMotion. */ -export default class PlayerComponent extends Component { +export default class Player extends Component { constructor(props) { super(props); - this.state = {value: props.value}; this.updateCurrentTime = this.updateCurrentTime.bind(this); this.updateInstanceMethods = this.updateInstanceMethods.bind(this); @@ -98,7 +97,7 @@ export default class PlayerComponent extends Component { } } -PlayerComponent.propTypes = { +Player.propTypes = { /** * The ID used to identify this compnent in Dash callbacks */ @@ -171,7 +170,9 @@ PlayerComponent.propTypes = { progressInterval: PropTypes.string, /** - * Applies the playsinline attribute where supported + * Applies the html5 playsinline attribute where supported, which allows + * videos to be played inline and will not automatically enter fullscreen + * mode when playback begins (for iOS). */ playsinline: PropTypes.bool, @@ -198,7 +199,7 @@ PlayerComponent.propTypes = { seekTo: PropTypes.number }; -PlayerComponent.defaultProps = { +Player.defaultProps = { playing: false, loop: false, controls: false, diff --git a/src/components/__tests__/ExampleComponent.test.js b/src/components/__tests__/ExampleComponent.test.js index 2c25af5..e02915d 100644 --- a/src/components/__tests__/ExampleComponent.test.js +++ b/src/components/__tests__/ExampleComponent.test.js @@ -1,11 +1,10 @@ import React from 'react'; import {shallow} from 'enzyme'; -import ExampleComponent from '../ExampleComponent.react'; describe('ExampleComponent', () => { it('renders', () => { - const component = shallow(); + const component = shallow(
); expect(component).to.be.ok; }); -}); +}); \ No newline at end of file diff --git a/src/index.js b/src/index.js index 18fc1fd..ee9661d 100644 --- a/src/index.js +++ b/src/index.js @@ -1,8 +1,6 @@ /* eslint-disable import/prefer-default-export */ -import ExampleComponent from './components/ExampleComponent.react'; -import PlayerComponent from './components/PlayerComponent.react'; +import Player from './components/Player.react'; export { - ExampleComponent, - PlayerComponent + Player }; diff --git a/usage-advanced.py b/usage-advanced.py index bc6508b..fdcbe87 100644 --- a/usage-advanced.py +++ b/usage-advanced.py @@ -19,7 +19,7 @@ app.layout = html.Div([ 'margin': '0% 5% 1% 5%' }, children=[ - dash_player.PlayerComponent( + dash_player.Player( id='video-player', url='http://media.w3.org/2010/05/bunny/movie.mp4', controls=True, diff --git a/usage-methods.py b/usage-methods.py index f63992c..f50d963 100644 --- a/usage-methods.py +++ b/usage-methods.py @@ -10,7 +10,7 @@ app.scripts.config.serve_locally = True app.layout = html.Div([ - dash_player.PlayerComponent( + dash_player.Player( id='video-player', url='http://media.w3.org/2010/05/bunny/movie.mp4', controls=True diff --git a/usage.py b/usage.py index fa551f4..20fca75 100644 --- a/usage.py +++ b/usage.py @@ -10,7 +10,7 @@ app.scripts.config.serve_locally = True app.layout = html.Div([ - dash_player.PlayerComponent( + dash_player.Player( id='video-player', url='http://media.w3.org/2010/05/bunny/movie.mp4', controls=True