-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1d7d90d
commit 8a0cf73
Showing
4 changed files
with
132 additions
and
41 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
const React = require('react'); | ||
|
||
const TrackControls = props => { | ||
const disabled = props.error !== undefined || props.filename === undefined; | ||
console.log(disabled, props); | ||
|
||
let playOrPause; | ||
if (props.action === 'play') { | ||
playOrPause = ( | ||
<button | ||
className="btn btn-secondary btn-sm" | ||
disabled={disabled} | ||
onClick={props.onPause} | ||
> | ||
Pause | ||
</button> | ||
); | ||
} else { | ||
playOrPause = ( | ||
<button | ||
className="btn btn-secondary btn-sm" | ||
disabled={disabled} | ||
onClick={props.onPlay} | ||
> | ||
Play | ||
</button> | ||
); | ||
} | ||
|
||
return ( | ||
<div> | ||
{playOrPause} | ||
<button | ||
className="btn btn-secondary btn-sm" | ||
disabled={disabled} | ||
onClick={props.onStop} | ||
style={{marginLeft: '0.25em'}} | ||
> | ||
Stop | ||
</button> | ||
</div> | ||
); | ||
}; | ||
|
||
TrackControls.propTypes = { | ||
action: React.PropTypes.string, | ||
error: React.PropTypes.shape({ | ||
type: React.PropTypes.string.isRequired, | ||
message: React.PropTypes.string.isRequired, | ||
}), | ||
filename: React.PropTypes.string, | ||
onPause: React.PropTypes.func, | ||
onPlay: React.PropTypes.func, | ||
onStop: React.PropTypes.func, | ||
}; | ||
|
||
module.exports = TrackControls; |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
.filename-label { | ||
padding-top: 16px; | ||
vertical-align: 2px; | ||
} | ||
} |
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