-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from G-Techs/refact-NewReleases
NewReleases component migrated to ts
- Loading branch information
Showing
19 changed files
with
294 additions
and
307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
declare module '*.jpg'; | ||
declare module '*.gif'; | ||
declare module '*.png'; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
/* eslint-disable @next/next/no-img-element */ | ||
import React, { useState } from "react"; | ||
import { songs } from "../utils/dummy"; | ||
import { VDots, VPause, VPlay, VStar, VWave } from "../__modules__/_Vectors"; | ||
import AudioPlayer from "../utils/config/audioPlayer"; | ||
import liveBg from "../static/images/livebg.jpg"; | ||
import equalizer from "../static/images/equalizer.gif"; | ||
import { ISong } from "../../../types"; | ||
|
||
const newRealeaseBg = { | ||
backgroundImage: `url(${liveBg.src})`, | ||
backgroundPosition: "center", | ||
backgroundSize: "cover", | ||
backgroundRepeat: "no-repeat", | ||
borderRadius: "20px", | ||
}; | ||
|
||
const NewReleases = () => { | ||
const [isPlaying, setIsPlaying] = useState(-1); | ||
const [isPaused, setIsPaused] = useState(false); | ||
const [tracks, setTracks] = useState<ISong[]>(songs); | ||
|
||
function playerControler(index:number){ | ||
return( | ||
<div | ||
onClick={() => { | ||
if (isPlaying === index && !isPaused) { | ||
setIsPaused(true); | ||
setIsPlaying(index); | ||
} else { | ||
setIsPaused(false); | ||
} | ||
setIsPlaying(index); | ||
}} | ||
className="px-4" | ||
> | ||
{isPlaying === index && !isPaused ? ( | ||
<VPause className="w-6 h-6" /> | ||
) : ( | ||
<VPlay className="w-6 h-6" /> | ||
)} | ||
</div> | ||
) | ||
} | ||
return ( | ||
<div | ||
className="mt-20 mr-5 bg-white shadow-lg rounded-bl-[50px]" | ||
> | ||
<p className="text-2xl py-5 px-5 bg-white text-gray-700 font-bold"> | ||
New Release | ||
</p> | ||
<div className="w-full relative overflow-hidden h-[32rem] rounded-bl-[50px] shadow-xl text-white"> | ||
<img | ||
src={liveBg.src} | ||
alt="live background" | ||
className="absolute h-full w-full object-cover rounded-tr-[50px] rounded-bl-[50px]" | ||
/> | ||
<div className="grid lg:grid-cols-2 grid-cols-1 h-full absolute w-full"> | ||
<div className="flex h-[8rem] flex-col justify-between lg:h-full "> | ||
<div className="lg:w-[10rem] w-full flex justify-center mx-auto my-auto"> | ||
<img | ||
src={equalizer.src} | ||
className="w-[20rem] h-[20rem] object-cover" | ||
/> | ||
</div> | ||
<div className="lg:block hidden"> | ||
<div className="mx-2 py-1 "> | ||
<AudioPlayer tracks={songs} /> | ||
</div> | ||
</div> | ||
</div> | ||
<div className="w-full p-5 overflow-y-scroll no-scrollbar lg:mt-0 mt-6"> | ||
{songs.map((item, index) => { | ||
return ( | ||
<div | ||
key={index} | ||
className={` ${ | ||
isPlaying === index ? "bg-black bg-opacity-10" : "" | ||
} flex hover:bg-opacity-50 hover:placeholder:bg-black my-4 p-2 items-center justify-between rounded-md`} | ||
> | ||
<div className="lg:w-20 lg:h-20 max-h-20 w-12 h-12 rounded-br-2xl rounded-tl-2xl overflow-hidden"> | ||
<img | ||
src={item.img} | ||
className="object-cover" | ||
alt={item.title} | ||
/> | ||
</div> | ||
<div className="flex flex-col "> | ||
<p className="lg:text-xl font-medium"> {item.title}</p> | ||
<p className="text-sm"> {item.artist}</p> | ||
</div> | ||
<div> | ||
<VStar className="w-6 h-6 lg:block hidden" /> | ||
</div> | ||
{playerControler(index)} | ||
<div> | ||
<VDots className="w-6 h-6 lg:block hidden text-[#d97706]" /> | ||
</div> | ||
</div> | ||
); | ||
})} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default NewReleases; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React, { FC } from "react"; | ||
import { VPrev, VNext, VPlay, VPause } from "../../__modules__/_Vectors" | ||
interface AudioControlsProps{ | ||
isPlaying:boolean; | ||
onPlayPauseClick:Function; | ||
onPrevClick: Function; | ||
onNextClick:Function; | ||
} | ||
|
||
const AudioControls: FC<AudioControlsProps> = ({ | ||
isPlaying, | ||
onPlayPauseClick, | ||
onPrevClick, | ||
onNextClick | ||
}) => ( | ||
<div className="flex justify-center p-4 space-x-9"> | ||
<button | ||
type="button" | ||
className="prev" | ||
aria-label="Previous" | ||
onClick={()=>onPrevClick}> | ||
<VPrev className="w-12 h-12" /> | ||
</button> | ||
{isPlaying ? ( | ||
<button | ||
type="button" | ||
className="pause" | ||
onClick={() => onPlayPauseClick(false)} | ||
aria-label="Pause" | ||
> | ||
<VPause className="w-12 h-12" /> | ||
</button> | ||
) : ( | ||
<button | ||
type="button" | ||
className="play" | ||
onClick={() => onPlayPauseClick(true)} | ||
aria-label="Play" | ||
> | ||
<VPlay className="w-12 h-12" /> | ||
</button> | ||
)} | ||
<button | ||
type="button" | ||
className="next" | ||
aria-label="Next" | ||
onClick={()=>onNextClick} | ||
> | ||
<VNext className="w-12 h-12" /> | ||
</button> | ||
</div> | ||
); | ||
|
||
export default AudioControls; |
Oops, something went wrong.
7d1cff2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
yokaa-frontend – ./
yokaa-frontend-yokaa.vercel.app
yokaa-frontend.vercel.app
yokaa-frontend-git-main-yokaa.vercel.app