import React, { useCallback, useEffect, useState } from "react"; import classNames from "classnames"; import { useDispatch, useSelector } from "react-redux"; import Spotlight from "@enact/spotlight"; import SpotlightContainerDecorator from "@enact/spotlight/SpotlightContainerDecorator"; import Spottable from "@enact/spotlight/Spottable"; import liveShow from "../../../../assets/images/tag-liveshow.png"; import { pushPanel } from "../../../actions/panelActions"; import { VideoPlayer } from "../../../components/VideoPlayer/VideoPlayer"; import useScrollReset from "../../../hooks/useScrollReset"; import { panel_names } from "../../../utils/Config"; import css from "./VodUnit.module.less"; const Container = SpotlightContainerDecorator( { enterTo: "last-focused" }, "div" ); const SpottableComponent = Spottable("div"); export default function VodUnit({ children, imageAlt, imgName, imgPath, showUrl, showNm, patncLogoPath, priceInfo, patnrId, prdtId, productId, productName, soldoutFlag, isHorizontal, shptmLnkTpNm, rolling, startIndex, lastIndex, currentIndex, getIndex, getFocus, spotlightId, scrollTop, ...rest }) { const dispatch = useDispatch(); const { handleScrollReset, handleStopScrolling } = useScrollReset(scrollTop); // 비디오 클릭 const handleClick = useCallback(() => { dispatch( pushPanel({ name: panel_names.PLAYER_PANEL, }) ); }, [dispatch]); // 화살표 아래키 누를시, 아래로 포커스 const [focusDown, setFocusDown] = useState(false); const handlePrev = useCallback(() => { if (currentIndex === 0) { getIndex(lastIndex); return; } getIndex(currentIndex - 1); }, [getIndex]); const handleNext = useCallback(() => { if (lastIndex === currentIndex) { getIndex(0); return; } getIndex(currentIndex + 1); }, [getIndex]); const onFocus = useCallback(() => { getFocus(true); handleScrollReset(); }, []); const onBlur = useCallback(() => { setFocusDown(false); getFocus(false); handleStopScrolling(); }, []); const onKeyDown = useCallback( (event) => { if (event.key === "ArrowDown") { setFocusDown(true); } }, [focusDown] ); return (

); }