@@ -90,75 +90,73 @@ export function APlayer({
90
90
const [ isPlaylistOpen , setPlaylistOpen ] = useState ( ( ) => hasPlaylist ) ;
91
91
92
92
return (
93
- < div style = { { width : 600 } } >
94
- < div
95
- className = { cx ( "aplayer aplayer-withlrc" , {
96
- "aplayer-loading" : audioControl . isLoading ,
97
- "aplayer-withlist" : hasPlaylist ,
98
- } ) }
99
- >
100
- < div className = "aplayer-body" >
93
+ < div
94
+ className = { cx ( "aplayer aplayer-withlrc" , {
95
+ "aplayer-loading" : audioControl . isLoading ,
96
+ "aplayer-withlist" : hasPlaylist ,
97
+ } ) }
98
+ >
99
+ < div className = "aplayer-body" >
100
+ < div
101
+ className = "aplayer-pic"
102
+ style = { {
103
+ backgroundImage : `url("${ playlist . currentSong ?. cover } ")` ,
104
+ } }
105
+ >
101
106
< div
102
- className = "aplayer-pic"
103
- style = { {
104
- backgroundImage : `url("${ playlist . currentSong ?. cover } ")` ,
105
- } }
107
+ className = { cx (
108
+ "aplayer-button" ,
109
+ audioControl . isPlaying ? "aplayer-pause" : "aplayer-play"
110
+ ) }
111
+ onClick = { ( ) => audioControl . togglePlay ( ) }
106
112
>
107
- < div
108
- className = { cx (
109
- "aplayer-button" ,
110
- audioControl . isPlaying ? "aplayer-pause" : "aplayer-play"
111
- ) }
112
- onClick = { ( ) => audioControl . togglePlay ( ) }
113
- >
114
- { audioControl . isPlaying ? < IconPause /> : < IconPlay /> }
115
- </ div >
113
+ { audioControl . isPlaying ? < IconPause /> : < IconPlay /> }
116
114
</ div >
117
- < div className = "aplayer-info" >
118
- < div className = "aplayer-music" >
119
- < span className = "aplayer-title" >
120
- { playlist . currentSong ?. name ?? "Audio name" }
121
- </ span >
122
- < span className = "aplayer-author" >
123
- { " " }
124
- - { playlist . currentSong ?. artist ?? "Audio artist" }
125
- </ span >
126
- </ div >
127
- < Lyrics
128
- lrcText = { playlist . currentSong . lrc }
129
- currentTime = { audioControl . currentTime }
130
- />
131
- < PlaybackControls
132
- volume = { audioControl . volume }
133
- onChangeVolume = { audioControl . updateVolume }
134
- muted = { audioControl . muted }
135
- onToggleMuted = { ( ) =>
136
- audioControl . muted ? audioControl . unmute ( ) : audioControl . mute ( )
137
- }
138
- themeColor = { playlist . currentSong ?. theme ?? theme }
139
- currentTime = { audioControl . currentTime }
140
- audioDurationSeconds = { audioControl . audioDuration }
141
- bufferedSeconds = { audioControl . bufferedSeconds }
142
- onSeek = { ( second ) => audioControl . seek ( second ) }
143
- onToggleMenu = { ( ) => setPlaylistOpen ( ( open ) => ! open ) }
144
- order = { playlist . order }
145
- onOrderChange = { playlist . setOrder }
146
- loop = { playlist . loop }
147
- onLoopChange = { playlist . setLoop }
148
- />
149
- </ div >
150
- < div className = "aplayer-notice" > </ div >
151
- < div className = "aplayer-miniswitcher" > </ div >
152
115
</ div >
153
- { hasPlaylist ? (
154
- < Playlist
155
- open = { isPlaylistOpen }
156
- audio = { audio }
157
- playingAudioUrl = { playlist . currentSong . url }
158
- onPlayAudio = { ( audioInfo ) => playlist . prioritize ( audioInfo ) }
116
+ < div className = "aplayer-info" >
117
+ < div className = "aplayer-music" >
118
+ < span className = "aplayer-title" >
119
+ { playlist . currentSong ?. name ?? "Audio name" }
120
+ </ span >
121
+ < span className = "aplayer-author" >
122
+ { " " }
123
+ - { playlist . currentSong ?. artist ?? "Audio artist" }
124
+ </ span >
125
+ </ div >
126
+ < Lyrics
127
+ lrcText = { playlist . currentSong . lrc }
128
+ currentTime = { audioControl . currentTime }
159
129
/>
160
- ) : null }
130
+ < PlaybackControls
131
+ volume = { audioControl . volume }
132
+ onChangeVolume = { audioControl . updateVolume }
133
+ muted = { audioControl . muted }
134
+ onToggleMuted = { ( ) =>
135
+ audioControl . muted ? audioControl . unmute ( ) : audioControl . mute ( )
136
+ }
137
+ themeColor = { playlist . currentSong ?. theme ?? theme }
138
+ currentTime = { audioControl . currentTime }
139
+ audioDurationSeconds = { audioControl . audioDuration }
140
+ bufferedSeconds = { audioControl . bufferedSeconds }
141
+ onSeek = { ( second ) => audioControl . seek ( second ) }
142
+ onToggleMenu = { ( ) => setPlaylistOpen ( ( open ) => ! open ) }
143
+ order = { playlist . order }
144
+ onOrderChange = { playlist . setOrder }
145
+ loop = { playlist . loop }
146
+ onLoopChange = { playlist . setLoop }
147
+ />
148
+ </ div >
149
+ < div className = "aplayer-notice" > </ div >
150
+ < div className = "aplayer-miniswitcher" > </ div >
161
151
</ div >
152
+ { hasPlaylist ? (
153
+ < Playlist
154
+ open = { isPlaylistOpen }
155
+ audio = { audio }
156
+ playingAudioUrl = { playlist . currentSong . url }
157
+ onPlayAudio = { ( audioInfo ) => playlist . prioritize ( audioInfo ) }
158
+ />
159
+ ) : null }
162
160
</ div >
163
161
) ;
164
162
}
0 commit comments