Simplify AudioTitle on mobile view
This commit is contained in:
@@ -27,12 +27,6 @@ const useStyle = makeStyles((theme) => ({
|
|||||||
'&.songTitle': {
|
'&.songTitle': {
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
},
|
},
|
||||||
'&.songInfo': {
|
|
||||||
// 768 is where the player swaps views
|
|
||||||
[theme.breakpoints.down(769)]: {
|
|
||||||
display: 'none',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
player: {
|
player: {
|
||||||
display: (props) => (props.visible ? 'block' : 'none'),
|
display: (props) => (props.visible ? 'block' : 'none'),
|
||||||
@@ -41,7 +35,7 @@ const useStyle = makeStyles((theme) => ({
|
|||||||
|
|
||||||
let audioInstance = null
|
let audioInstance = null
|
||||||
|
|
||||||
const AudioTitle = ({ audioInfo, className }) => {
|
const AudioTitle = React.memo(({ audioInfo, isMobile, className }) => {
|
||||||
if (!audioInfo.name) {
|
if (!audioInfo.name) {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
@@ -49,13 +43,17 @@ const AudioTitle = ({ audioInfo, className }) => {
|
|||||||
return (
|
return (
|
||||||
<Link to={`/album/${audioInfo.albumId}/show`} className={className}>
|
<Link to={`/album/${audioInfo.albumId}/show`} className={className}>
|
||||||
<span className={`${className} songTitle`}>{audioInfo.name}</span>
|
<span className={`${className} songTitle`}>{audioInfo.name}</span>
|
||||||
|
{!isMobile && (
|
||||||
|
<>
|
||||||
<br />
|
<br />
|
||||||
<span className={`${className} songInfo`}>
|
<span className={`${className} songInfo`}>
|
||||||
{`${audioInfo.singer} - ${audioInfo.album}`}
|
{`${audioInfo.singer} - ${audioInfo.album}`}
|
||||||
</span>
|
</span>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</Link>
|
</Link>
|
||||||
)
|
)
|
||||||
}
|
})
|
||||||
|
|
||||||
const Player = () => {
|
const Player = () => {
|
||||||
const translate = useTranslate()
|
const translate = useTranslate()
|
||||||
@@ -144,8 +142,12 @@ const Player = () => {
|
|||||||
top: 300,
|
top: 300,
|
||||||
left: 120,
|
left: 120,
|
||||||
},
|
},
|
||||||
renderAudioTitle: (audioInfo) => (
|
renderAudioTitle: (audioInfo, isMobile) => (
|
||||||
<AudioTitle audioInfo={audioInfo} className={classes.audioTitle} />
|
<AudioTitle
|
||||||
|
audioInfo={audioInfo}
|
||||||
|
isMobile={isMobile}
|
||||||
|
className={classes.audioTitle}
|
||||||
|
/>
|
||||||
),
|
),
|
||||||
locale: {
|
locale: {
|
||||||
playListsText: translate('player.playListsText'),
|
playListsText: translate('player.playListsText'),
|
||||||
|
|||||||
Reference in New Issue
Block a user