feat: initial integration of react-jinke-music-player

This commit is contained in:
Deluan
2020-02-04 09:26:54 -05:00
parent 220ffd5324
commit 4a82a6cb02
13 changed files with 417 additions and 44 deletions
+30
View File
@@ -0,0 +1,30 @@
import React from 'react'
import PropTypes from 'prop-types'
import PlayArrowIcon from '@material-ui/icons/PlayArrow'
import { IconButton } from '@material-ui/core'
import { useDispatch } from 'react-redux'
import { setTrack } from '../player'
const defaultIcon = <PlayArrowIcon fontSize="small" />
const PlayButton = ({
record,
icon = defaultIcon,
action = setTrack,
...rest
}) => {
const dispatch = useDispatch()
return (
<IconButton onClick={() => dispatch(action(record))} {...rest}>
{icon}
</IconButton>
)
}
PlayButton.propTypes = {
record: PropTypes.any,
icon: PropTypes.element,
action: PropTypes.func
}
export default PlayButton