-
Notifications
You must be signed in to change notification settings - Fork 94
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 #5 from trash-lobster/next-multiview
Add hover card for stream details
- Loading branch information
Showing
4 changed files
with
113 additions
and
20 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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// import { useChannel } from "@/services/channel.service"; | ||
import { LiveChannelIcon } from "./LiveChannelIcon"; | ||
import { LiveStreamInfo } from "./LiveStreamInfo"; | ||
import { useState } from "react"; | ||
|
||
interface LiveChannelProps { | ||
channelImgLink?: string; | ||
channelName?: string; | ||
altText?: string; | ||
streamTitle?: string; | ||
topicId?: string; | ||
videoId?: string; | ||
} | ||
|
||
export function LiveChannel({ | ||
channelImgLink, | ||
channelName, | ||
altText, | ||
streamTitle, | ||
topicId, | ||
videoId, | ||
}: LiveChannelProps) { | ||
const [isHover, setIsHover] = useState(false); | ||
|
||
return ( | ||
<div> | ||
<LiveChannelIcon | ||
imageLink={channelImgLink} | ||
channelName={channelName} | ||
setIsHover={setIsHover} | ||
/> | ||
<LiveStreamInfo | ||
thumbnailLink={`https://i.ytimg.com/vi/${videoId}/mqdefault.jpg`} | ||
altText={altText} | ||
streamTitle={streamTitle} | ||
channelName={channelName} | ||
topicId={topicId} | ||
isVisible={isHover} | ||
/> | ||
</div> | ||
); | ||
} |
11 changes: 10 additions & 1 deletion
11
packages/react/src/components/multiview/LiveChannelIcon.tsx
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
48 changes: 48 additions & 0 deletions
48
packages/react/src/components/multiview/LiveStreamInfo.tsx
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,48 @@ | ||
import { cn } from "@/lib/utils"; | ||
|
||
interface LiveStreamInfoProps { | ||
thumbnailLink?: string; | ||
altText?: string; | ||
streamTitle?: string; | ||
channelName?: string; | ||
topicId?: string; | ||
isVisible: boolean; | ||
} | ||
|
||
export function LiveStreamInfo({ | ||
thumbnailLink, | ||
altText, | ||
streamTitle, | ||
channelName, | ||
topicId, | ||
isVisible, | ||
}: LiveStreamInfoProps) { | ||
return ( | ||
<div | ||
className={cn( | ||
// currently hardcoded a translate value, will investigate to find a better way | ||
" absolute flex translate-x-[-118px] translate-y-2 flex-col rounded-md bg-base-6 opacity-80", | ||
{ | ||
visible: isVisible, | ||
invisible: !isVisible, | ||
}, | ||
)} | ||
> | ||
<div className="relative flex w-full flex-col items-center px-4 py-2"> | ||
<img | ||
className="h-auto w-64 rounded-lg" | ||
src={thumbnailLink} | ||
alt={altText} | ||
/> | ||
<p className="absolute left-4 top-2 z-30 bg-black px-1 py-0.5 text-white opacity-80"> | ||
{topicId} | ||
</p> | ||
</div> | ||
<div> | ||
<p>{streamTitle}</p> | ||
<p>{channelName}</p> | ||
<p>status</p> | ||
</div> | ||
</div> | ||
); | ||
} |
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