Skip to content

Commit 1c5ef50

Browse files
committed
feat: add download count next to download button
1 parent 50f2ae1 commit 1c5ef50

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

web/src/modules/song/components/SongPageButtons.tsx

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,12 @@ const DownloadSongButton = ({
205205
song: {
206206
publicId: string;
207207
title: string;
208+
downloadCount: number;
208209
};
209210
}) => {
210211
return (
211212
<DownloadButton
213+
downloadCount={song.downloadCount}
212214
handleClick={() => {
213215
downloadSongFile(song);
214216
}}
@@ -217,20 +219,25 @@ const DownloadSongButton = ({
217219
};
218220

219221
const DownloadButton = ({
222+
downloadCount,
220223
handleClick,
221224
}: {
225+
downloadCount: number;
222226
handleClick: React.MouseEventHandler<HTMLButtonElement>;
223227
}) => {
224228
return (
225-
<button
226-
onClick={handleClick}
227-
className='uppercase px-2 py-1 h-fit rounded-md text-sm bg-green-600 hover:bg-green-500'
228-
>
229-
<div className='flex flex-row items-center gap-2'>
230-
<FontAwesomeIcon icon={faDownload} />
231-
<div>Download</div>
232-
</div>
233-
</button>
229+
<div className='flex gap-0.5'>
230+
<button
231+
onClick={handleClick}
232+
className='uppercase px-2 py-1 h-fit rounded-md text-sm bg-green-600 hover:bg-green-500'
233+
>
234+
<div className='flex flex-row items-center gap-2'>
235+
<FontAwesomeIcon icon={faDownload} />
236+
<div>Download</div>
237+
</div>
238+
</button>
239+
<CountBalloon count={downloadCount} />
240+
</div>
234241
);
235242
};
236243

0 commit comments

Comments
 (0)