UNPKG

@tycoonsystems/tycoon-modules

Version:
1 lines 2.77 kB
import React from"react";import Image from"next/image";import Link from"next/link";import VideoItemStyles from"./videoItem.module.scss";const VideoItem=t=>{let{item:a,index:i,setActive:n,unsetActiveItem:c,activeItem:e,previousActiveItemData:r}=t,m=React.useRef();React.useEffect(()=>{const e=e=>{n(e,i,a,r)},t=()=>{c(i)};return"number"==typeof i&&m&&m.current&&a&&(m.current.addEventListener("mouseenter",e),m.current.addEventListener("mouseleave",t)),()=>{m&&m.current&&a&&(m.current.removeEventListener("mouseenter",e),m.current.removeEventListener("mouseleave",t))}},[i,m,a,e,r]);return React.createElement("div",{className:VideoItemStyles.leadContainer+" Item_GhostMetaItemContainer",key:i},React.createElement("div",{className:e==i?VideoItemStyles.container+" activeVideoItemContainer":""+VideoItemStyles.container,ref:m},React.createElement(Link,{href:"w?v="+a.id,style:{display:"grid"}},React.createElement("div",{className:e==i?`${VideoItemStyles.ghostVideoContainer} ${VideoItemStyles.ghostVideoContainerActive} ghostVideoContainerItem ghostVideoContainerItemActive`:VideoItemStyles.ghostVideoContainer+" ghostVideoContainerItem"},React.createElement("div",{className:"ghostVideoItem"}),React.createElement("div",{className:"ghostVideoMeta"},React.createElement("div",null,a.title)))),React.createElement(Link,{href:"w?v="+a.id,style:{display:"grid"}},a&&"Live"==a.__typename&&"live"==a.status?React.createElement("div",{className:"LiveTag",style:{borderRadius:".25rem"}},"LIVE",React.createElement("div",{className:"RecordingCircle RecordingCircle_Small"})):null,React.createElement("div",{className:"Item_GhostMetaContainer"},a&&"Live"==a.__typename?React.createElement("div",{className:"Item_GhostMeta"},!a.creation||isNaN(a.creation)||isNaN(new Date(Number(a.creation)))?null:React.createElement("div",{className:"Item_TinyMetaText",style:{marginBottom:".25rem",textShadow:"1px 2px 6px rgb(0 0 0 / 75%)"}},"Stream started ",new Date(Number(a.creation)).toTimeString()),React.createElement("div",{className:"Item_GhostMetaContainerInternal"},React.createElement("div",null,a.description||"Watch Livestream Now"))):null),React.createElement(Image,{loader:({src:e})=>e.match(/greythumb/)?""+e:t.cdn&&t.cdn.static&&0<t.cdn.static.length?t.cdn.static+"/"+e:void 0,src:(e=>{e.gif&&t.cdn&&t.cdn.static?e.gif:e.thumbnail&&t.cdn&&t.cdn.static&&e.thumbnail;return e.gif&&t.cdn&&t.cdn.static?e.gif:e.thumbnail&&t.cdn&&t.cdn.static?e.thumbnail:e?.thumbtrack&&0<e.thumbtrack.length&&t.cdn.static?"thumbtrack/"+e.thumbtrack[0]:"img/default/greythumb.jpg"})(a),alt:a.title||"",width:320,height:180,layout:"responsive"}))),React.createElement("div",{className:""+VideoItemStyles.metaContainer},React.createElement("div",null,a&&a.title?a.title:null)))};export default VideoItem;