Add MusicContainer -> wrap App for music continous rendering
parent
12f76f9b5f
commit
449399a183
|
@ -2,8 +2,6 @@ import React, { Component } from 'react';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import '../styles/App.css';
|
import '../styles/App.css';
|
||||||
import Modal from 'react-modal';
|
import Modal from 'react-modal';
|
||||||
import Sound from 'react-sound';
|
|
||||||
|
|
||||||
|
|
||||||
const customStyles = {
|
const customStyles = {
|
||||||
content : {
|
content : {
|
||||||
|
@ -123,13 +121,6 @@ class App extends Component {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="App container">
|
<div className="App container">
|
||||||
<Sound
|
|
||||||
url="/music.mp3"
|
|
||||||
playStatus={Sound.status.PLAYING}
|
|
||||||
playFromPosition={0}
|
|
||||||
volume={55}
|
|
||||||
loop={true}
|
|
||||||
/>
|
|
||||||
<Modal
|
<Modal
|
||||||
isOpen={this.state.modalIsOpen}
|
isOpen={this.state.modalIsOpen}
|
||||||
onAfterOpen={this.afterOpenModal}
|
onAfterOpen={this.afterOpenModal}
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
import React, { Component } from 'react';
|
||||||
|
import axios from 'axios';
|
||||||
|
import App from './App';
|
||||||
|
import Sound from 'react-sound';
|
||||||
|
|
||||||
|
|
||||||
|
class MusicContainer extends Component {
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
position: 0
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Sound
|
||||||
|
url="/music.mp3"
|
||||||
|
playStatus={Sound.status.PLAYING}
|
||||||
|
playFromPosition={this.state.position}
|
||||||
|
volume={55}
|
||||||
|
onPlaying={(obj) => this.setState({position: obj.position})}
|
||||||
|
loop={true}
|
||||||
|
/>
|
||||||
|
<App />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default MusicContainer;
|
|
@ -1,13 +1,13 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { Switch, Route } from 'react-router-dom'
|
import { Switch, Route } from 'react-router-dom'
|
||||||
import Home from './Home'
|
import Home from './Home'
|
||||||
import App from './App'
|
import MusicContainer from './MusicContainer'
|
||||||
|
|
||||||
const Router = () => (
|
const Router = () => (
|
||||||
<main>
|
<main>
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route exact path='/' component={Home}/>
|
<Route exact path='/' component={Home}/>
|
||||||
<Route path='/app' component={App}/>
|
<Route path='/app' component={MusicContainer}/>
|
||||||
</Switch>
|
</Switch>
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue