File size: 1,059 Bytes
f5071ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
26
27
28
29
30
31
32
33
34
35
import React, { useContext, useEffect, useState } from 'react'
import { AppContext } from '../../context/AppContext';
import AudioPlayer from './AudioPlayer';
import Player from './Player';

const Footer = () => {

  const {playing,currentTrack} = useContext(AppContext);
  const [audioUrl,setAudioUrl] = useState(playing);
  
  useEffect(()=>{
    console.log("playing change");
    setAudioUrl(playing);
  },[playing])

  return (
    <div className='footer pt-1 flex w-full h-[90px] bg-[#212121] border-yellow-700 fixed bottom-0 '>
      <div className='footer-left flex items-center justify-center gap-x-2 pr-0 w-[200px]'>
                
              <img className='footer-img h-[50px] ml-2 w-[50px]' src={currentTrack?.album?.images[0]?.url}  />
              <p className='footer-text text-white my-auto'>{currentTrack?.album?.name.split("(")[0]}</p>
      </div>

      <div className='w-full align-middle mx-auto'>
      {
        playing ? <Player src={audioUrl}/> : <Player />
      }
      </div>
      
    </div>
  )
}

export default Footer