11import React from 'react'
22import { Icon , Tooltip } from '@blueprintjs/core'
3+ import cn from 'classnames'
34
45import Artists from 'components/Artists'
56import AudioTimer from './AudioTimer'
@@ -8,18 +9,31 @@ import PlayRecord from './PlayRecord'
89import PlayMode from './PlayMode'
910import PlayOperations from './PlayOperations'
1011import PlayVolume from './PlayVolume'
11- import { PlayMusicStateContext } from 'reducers/playMusic'
12+ import { PlayMusicStateContext , PlayMusicDispatchContext , ACTIONS } from 'reducers/playMusic'
1213import styles from './style.module.css'
1314
1415const { useContext, useState } = React
1516
1617const Footer = ( ) => {
1718 const [ showPlayRecord , setShowPlayRecord ] = useState ( false )
19+ const dispatch = useContext ( PlayMusicDispatchContext )
1820 const state = useContext ( PlayMusicStateContext )
19- const { musicId, music } = state
21+ const { musicId, music, showLyric } = state
2022
2123 const togglePlayRecord = ( ) => setShowPlayRecord ( ! showPlayRecord )
2224
25+ const handleShowLyric = ( ) => {
26+ dispatch ( {
27+ type : ACTIONS . SHOW_LYRIC
28+ } )
29+ }
30+
31+ const handleHideLyric = ( ) => {
32+ dispatch ( {
33+ type : ACTIONS . HIDE_LYRIC
34+ } )
35+ }
36+
2337 return (
2438 < div className = { styles . root } >
2539 { musicId ? (
@@ -29,7 +43,15 @@ const Footer = () => {
2943 ) : null }
3044
3145 < div className = { styles . songWrap } >
32- < img src = { music ?. picUrl ? `${ music ?. picUrl } ?param=40y40` : undefined } loading = 'lazy' />
46+ < div className = { cn ( styles . pic , ! showLyric && styles . showLyric ) } >
47+ < img src = { music ?. picUrl ? `${ music ?. picUrl } ?param=40y40` : undefined } loading = 'lazy' />
48+ { ! showLyric && < div className = { styles . mask } onClick = { handleShowLyric } >
49+ < Icon icon = 'double-chevron-up' />
50+ </ div > }
51+ { showLyric && < div className = { cn ( styles . mask , styles . hideLyric ) } onClick = { handleHideLyric } >
52+ < Icon icon = 'double-chevron-down' />
53+ </ div > }
54+ </ div >
3355 < div >
3456 < div className = { styles . info } >
3557 < div className = { styles . name } > { `${ music ?. name || '--' } -` } </ div >
0 commit comments