This file contains hidden or 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
componentWillUnmount() { | |
this.chart.destroy(); | |
this.resetLocalStorage(); | |
this.clearSession(); | |
} |
This file contains hidden or 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
componentDidMount() { | |
if (this.props.modules) { | |
this.props.modules.forEach(function (module) { | |
module(Highcharts); | |
}); | |
} | |
// Set container which the chart should render to. | |
this.chart = new Highcharts[this.props.type || "Chart"]( | |
this.props.container, | |
this.props.options |
This file contains hidden or 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
render() { | |
<div> | |
<PlayHeader> | |
<Status/> | |
<VolumeBar/> | |
<SeekBar/> | |
</PlayHeader> | |
</div> | |
} |
This file contains hidden or 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
import React from 'react'; | |
import lightLogo from './../assets/medium_light.png'; | |
import darkLogo from './../assets/medium_dark.png'; | |
export const themeConfig = { | |
light: { | |
headerBg: '#F7B30C', | |
fontColor: 'black', | |
bodybg: 'white', | |
logo: lightLogo | |
}, |
This file contains hidden or 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
import React, { Component } from 'react'; | |
import Header from './Header.component'; | |
import Body from './Body.component'; | |
import ThemeContext from './context/ThemeContext'; | |
import {themeConfig} from './context/ThemeContext'; | |
class App extends Component { | |
constructor() { | |
super(); |
This file contains hidden or 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
import React, { Component } from 'react' | |
import ThemeContext from './context/ThemeContext'; | |
export default class Body extends Component { | |
render() { | |
return ( | |
<ThemeContext.Consumer> | |
{ | |
(theme) => ( | |
<div className="body" style={{color: theme.fontColor, background: theme.bodybg}}> |
This file contains hidden or 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
class ContraMusicPlayer extends React.Component | |
constructor(props) { | |
super(props); | |
this.state = { | |
volume: 70, | |
status: 'pause' | |
} | |
} |
This file contains hidden or 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
static getDerivedStateFromProps(props, state) { | |
if (state.value !== props.value) { | |
return { | |
derivedValue: deriveValueFromProps(props), | |
mirroredProp: props.value | |
} | |
} | |
// when null is returned no update is made to the state | |
return null; | |
} |
This file contains hidden or 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
render() { | |
<div> | |
<PlayHeader> | |
<Status/> | |
<VolumeBar/> | |
<SeekBar/> | |
</PlayHeader> | |
</div> | |
} |
This file contains hidden or 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
componentDidMount() { | |
if (this.props.modules) { | |
this.props.modules.forEach(function (module) { | |
module(Highcharts); | |
}); | |
} | |
// Set container which the chart should render to. | |
this.chart = new Highcharts[this.props.type || "Chart"]( | |
this.props.container, | |
this.props.options |