20 |
21 |
Popular
22 |
23 |
24 | {!isLoading
25 | ? songList
26 | ?.slice(0, isLess ? 5 : 10)
27 | .map((item, index: number) => (
28 |
39 | ))
40 | : Array(10)
41 | .fill(0)
42 | ?.slice(0, isLess ? 5 : 10)
43 | .map((item: any, index: number) => (
44 |
45 | ))}
46 |
47 | {songList?.length && songList?.length > 5 && (
48 |
49 |
52 |
53 | )}
54 |
55 | )
56 | }
57 |
58 | export default memo(TopTrack)
59 |
--------------------------------------------------------------------------------
/src/contexts/SearchContext.tsx:
--------------------------------------------------------------------------------
1 | import searchApi from '@/apis/searchApi'
2 | import { REDIRECT_URI } from '@/constants/auth'
3 | import { SearchBannerItem } from '@/types/search'
4 | import { FC, ReactNode, createContext, useEffect, useRef, useState } from 'react'
5 | interface SearchProviderProps {
6 | children: ReactNode
7 | }
8 |
9 | interface SearchContext {
10 | setQuery: React.Dispatch