blob: 92933cfd669ea14c66f0fb3ee34483227af8bceb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
import { connect } from 'react-redux'
import { audioPlayFile } from '../actions'
import Link from '../components/UI/Link.jsx'
const mapStateToProps = (state, ownProps) => ({
children: ownProps.children || ownProps.file ? ownProps.file.name : "(~)",
disabled: ownProps.disabled || ! ownProps.file
})
const mapDispatchToProps = (dispatch, ownProps) => ({
onClick: () => {
switch (ownProps.file.type) {
case 'audio':
dispatch(audioPlayFile(ownProps.file))
break
}
}
})
const FileLink = connect(
mapStateToProps,
mapDispatchToProps
)(Link)
export default FileLink
|