[HomePanel] 더보기 버튼 포커싱 관련 처리건

- 정보들어올때 그려주는식으로 변경.
This commit is contained in:
junghoon86.park
2024-02-22 19:11:41 +09:00
parent 95ca999351
commit 9ab8a812d4
3 changed files with 39 additions and 25 deletions

View File

@@ -1,4 +1,4 @@
import React from "react"; import React, { useEffect, useState } from "react";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
@@ -23,11 +23,15 @@ const BestSeller = () => {
const bestSellerDatas = useSelector( const bestSellerDatas = useSelector(
(state) => state.product.bestSellerData.bestSeller (state) => state.product.bestSellerData.bestSeller
); );
const [drawChk, setDrawChk] = useState(false);
const { getScrollTo, scrollLeft } = useScrollTo(); const { getScrollTo, scrollLeft } = useScrollTo();
const { handleScrollReset, handleStopScrolling } = useScrollReset( const { handleScrollReset, handleStopScrolling } = useScrollReset(
scrollLeft, scrollLeft,
true true
); );
useEffect(() => {
setDrawChk(true);
}, [bestSellerDatas]);
return ( return (
<Container className={css.bestSellerWrap}> <Container className={css.bestSellerWrap}>
<SectionTitle title={$L(`BEST SELLER`)} /> <SectionTitle title={$L(`BEST SELLER`)} />
@@ -53,7 +57,9 @@ const BestSeller = () => {
/> />
))} ))}
<SpottableComponent className={css.addItem}></SpottableComponent> {drawChk && (
<SpottableComponent className={css.addItem}></SpottableComponent>
)}
</TScroller> </TScroller>
</Container> </Container>
); );

View File

@@ -1,4 +1,4 @@
import React from "react"; import React, { useEffect, useState } from "react";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
@@ -21,13 +21,15 @@ const Container = SpotlightContainerDecorator(
const PopularShow = ({ ...rest }) => { const PopularShow = ({ ...rest }) => {
const topInfos = useSelector((state) => state.main.top20ShowData.topInfos); const topInfos = useSelector((state) => state.main.top20ShowData.topInfos);
const [drawChk, setDrawChk] = useState(false);
const { getScrollTo, scrollLeft } = useScrollTo(); const { getScrollTo, scrollLeft } = useScrollTo();
const { handleScrollReset, handleStopScrolling } = useScrollReset( const { handleScrollReset, handleStopScrolling } = useScrollReset(
scrollLeft, scrollLeft,
true true
); );
useEffect(() => {
setDrawChk(true);
}, [topInfos]);
return ( return (
<Container className={css.popularShow}> <Container className={css.popularShow}>
<SectionTitle className={css.subTitle} title={$L(`POPULAR SHOW`)} /> <SectionTitle className={css.subTitle} title={$L(`POPULAR SHOW`)} />
@@ -38,24 +40,28 @@ const PopularShow = ({ ...rest }) => {
noScrollByWheel noScrollByWheel
> >
{topInfos && {topInfos &&
topInfos.map((item, index) => ( topInfos.map((item, index) => {
<TItemCard return (
key={item.showId} <TItemCard
imageSource={ key={item.showId}
item.thumbnailUrl !== item.thumbnailUrl960 imageSource={
? item.thumbnailUrl960 item.thumbnailUrl !== item.thumbnailUrl960
: item.thumbnailUrl ? item.thumbnailUrl960
} : item.thumbnailUrl
imageAlt={item.showNm} }
productName={item.showNm} imageAlt={item.showNm}
nonPosition={true} productName={item.showNm}
type={TYPES.videoShow} nonPosition={true}
onFocus={index === 0 ? handleScrollReset : null} type={TYPES.videoShow}
onBlur={handleStopScrolling} onFocus={index === 0 ? handleScrollReset : null}
/> onBlur={handleStopScrolling}
))} />
);
})}
<SpottableComponent className={css.addItem}></SpottableComponent> {drawChk && (
<SpottableComponent className={css.addItem}></SpottableComponent>
)}
</TScroller> </TScroller>
</Container> </Container>
); );

View File

@@ -31,7 +31,7 @@ const SubCategory = () => {
(state) => state.main.subCategoryData.categoryItemInfos (state) => state.main.subCategoryData.categoryItemInfos
); );
const [currentLgCatCd, setCurrentLgCatCd] = useState(null); const [currentLgCatCd, setCurrentLgCatCd] = useState(null);
const [drawChk, setDrawChk] = useState(false);
const handleCategoryNav = (lgCatCd, LgCatNm) => { const handleCategoryNav = (lgCatCd, LgCatNm) => {
if (currentLgCatCd === lgCatCd) { if (currentLgCatCd === lgCatCd) {
return; return;
@@ -66,6 +66,7 @@ const SubCategory = () => {
false false
) )
); );
setDrawChk(true);
} }
}, [currentLgCatCd, dispatch]); }, [currentLgCatCd, dispatch]);
@@ -81,7 +82,6 @@ const SubCategory = () => {
className={css.home} className={css.home}
direction="horizontal" direction="horizontal"
cbScrollTo={getScrollTo} cbScrollTo={getScrollTo}
noScrollByWheel
> >
{categoryItemInfos && {categoryItemInfos &&
categoryItemInfos.map((item, index) => { categoryItemInfos.map((item, index) => {
@@ -99,7 +99,9 @@ const SubCategory = () => {
); );
})} })}
<SpottableComponent className={css.addItem}></SpottableComponent> {drawChk && (
<SpottableComponent className={css.addItem}></SpottableComponent>
)}
</TScroller> </TScroller>
</Container> </Container>
); );