-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTopCharts.jsx
36 lines (29 loc) · 1007 Bytes
/
TopCharts.jsx
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
36
import { useSelector } from 'react-redux';
import { Error, Loader, SongCard } from '../components';
import { useGetTopChartsQuery } from '../redux/services/shazamCore';
const TopCharts = () => {
const { activeSong, isPlaying } = useSelector((state) => state.player);
const { data, isFetching, error } = useGetTopChartsQuery();
if (isFetching) return <Loader title="Loading top charts" />;
if (error) return <Error />;
return (
<div className="flex flex-col">
<h2 className="font-bold text-3xl text-white text-left mt-4 mb-10">
Discover Top Charts
</h2>
<div className="flex flex-wrap sm:justify-start justify-center gap-8">
{data?.map((song, i) => (
<SongCard
key={song.key}
song={song}
isPlaying={isPlaying}
activeSong={activeSong}
data={data}
i={i}
/>
))}
</div>
</div>
);
};
export default TopCharts;