-
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.
WIP: display drawer on mobile when clicking on track info
- Loading branch information
Showing
4 changed files
with
98 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,34 @@ | ||
import { DotsHorizontalIcon } from "@radix-ui/react-icons"; | ||
|
||
import LikeButton from "@/components/LikeButton"; | ||
|
||
import { Drawer, DrawerContent, DrawerTrigger } from "@/components/ui/drawer"; | ||
|
||
import TrackActionsDrawerContent from "./TrackActionsDrawerContent"; | ||
import { useTrackContext } from "./context"; | ||
|
||
const TrackActions = () => { | ||
const { track } = useTrackContext(); | ||
|
||
return <LikeButton trackId={track.id} />; | ||
return ( | ||
<> | ||
<div className="sm:hidden"> | ||
<Drawer> | ||
<DrawerTrigger asChild> | ||
<DotsHorizontalIcon className="h-5 w-5" /> | ||
</DrawerTrigger> | ||
|
||
<DrawerContent className="bg-transparent/60 h-screen"> | ||
<TrackActionsDrawerContent /> | ||
</DrawerContent> | ||
</Drawer> | ||
</div> | ||
|
||
<div className="hidden"> | ||
<LikeButton trackId={track.id} /> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default TrackActions; |
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,74 @@ | ||
import { | ||
LibraryIcon, | ||
ListPlusIcon, | ||
ListStartIcon, | ||
Mic2Icon, | ||
RadioIcon, | ||
ShareIcon, | ||
UsersIcon, | ||
} from "lucide-react"; | ||
|
||
import useTrack from "@/hooks/useTrack"; | ||
|
||
import Cover from "@/components/Cover"; | ||
|
||
import { useTrackContext } from "./context"; | ||
|
||
function TrackActionsDrawerContent() { | ||
const { track } = useTrackContext(); | ||
const fullTrack = useTrack(track.id); | ||
|
||
if (!fullTrack) return null; | ||
|
||
return ( | ||
<div className="flex flex-col gap-6 border"> | ||
<div className="flex flex-col gap-2 justify-center items-center"> | ||
<Cover | ||
alt={`${fullTrack.name} cover`} | ||
size="medium" | ||
src={fullTrack.album.images[0].url} | ||
/> | ||
|
||
<div> | ||
<h1>{fullTrack.name}</h1> | ||
<p> | ||
{fullTrack.artists[0].name} - {fullTrack.album.name} | ||
</p> | ||
</div> | ||
</div> | ||
|
||
<ul className="flex flex-col gap-4"> | ||
<li className="flex gap-2"> | ||
<ListPlusIcon /> | ||
Add to a playlist | ||
</li> | ||
<li className="flex gap-2"> | ||
<ListStartIcon /> | ||
Add to queue | ||
</li> | ||
<li className="flex gap-2"> | ||
<ShareIcon /> | ||
Share | ||
</li> | ||
<li className="flex gap-2"> | ||
<RadioIcon /> | ||
Go to radio | ||
</li> | ||
<li className="flex gap-2"> | ||
<LibraryIcon /> | ||
Album | ||
</li> | ||
<li className="flex gap-2"> | ||
<Mic2Icon /> | ||
Artists | ||
</li> | ||
<li className="flex gap-2"> | ||
<UsersIcon /> | ||
Credits | ||
</li> | ||
</ul> | ||
</div> | ||
); | ||
} | ||
|
||
export default TrackActionsDrawerContent; |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.