[HOT PICKS] 포커스 기능 추가

Detail Notes :
 
1. 전체 타입에 포커스 기능 추가
2. 추후 진행 예정 작업
> 클릭 이벤트
> 영상
This commit is contained in:
jangheon Pyo
2024-02-13 14:24:00 +09:00
parent a6af66d843
commit d16433826c
15 changed files with 155 additions and 84 deletions

View File

@@ -58,8 +58,6 @@ export default function HotPicksPanel() {
); );
}, [currentPage]); }, [currentPage]);
console.log("##themeCurationInfoData", themeCurationInfoData);
let typeComponent; let typeComponent;
switch (currentType) { switch (currentType) {
case "TCFI": // Full Image case "TCFI": // Full Image
@@ -125,7 +123,6 @@ export default function HotPicksPanel() {
return ( return (
<TPanel> <TPanel>
<TBody className={css.hotPicks}> <TBody className={css.hotPicks}>
<h2>Type : {currentType}</h2>
{currentPage > 0 && ( {currentPage > 0 && (
<p className={classNames(css.arrow, css.arrowPrev)}> <p className={classNames(css.arrow, css.arrowPrev)}>
<SpottableComponent onClick={handlePrev}>이전</SpottableComponent> <SpottableComponent onClick={handlePrev}>이전</SpottableComponent>

View File

@@ -12,11 +12,6 @@ const SpottableComponent = Spottable("div");
export default function TCFI({ className, data }) { export default function TCFI({ className, data }) {
useEffect(() => { useEffect(() => {
Spotlight.focus("spotData"); Spotlight.focus("spotData");
// if (data) {
// const showInfos = data[0]?.showInfos[0];
// const id = showInfos.showId;
// Spotlight.focus("spotlight" + id);
// }
}, [data]); }, [data]);
return ( return (
<> <>
@@ -28,9 +23,7 @@ export default function TCFI({ className, data }) {
className={css.fullImg} className={css.fullImg}
spotlightId="spotData" spotlightId="spotData"
> >
<p>
<img src={bgImgPath} alt={curationNm} /> <img src={bgImgPath} alt={curationNm} />
</p>
</SpottableComponent> </SpottableComponent>
</div> </div>
); );

View File

@@ -2,12 +2,10 @@
@import "../../../../style/utils.module.less"; @import "../../../../style/utils.module.less";
.fullImg { .fullImg {
&:focus-within {
> p {
position: relative; position: relative;
&:focus-within {
&::after { &::after {
.focused(); .focused();
} }
} }
} }
}

View File

@@ -1,15 +1,29 @@
import React from 'react'; import React, { useEffect } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import Spotlight from '@enact/spotlight';
import SpotlightContainerDecorator
from '@enact/spotlight/SpotlightContainerDecorator';
import Spottable from '@enact/spotlight/Spottable'; import Spottable from '@enact/spotlight/Spottable';
import css from './TCFI_2.module.less'; import css from './TCFI_2.module.less';
const SpottableComponent = Spottable("li"); const SpottableComponent = Spottable("li");
const Container = SpotlightContainerDecorator(
{ enterTo: "last-focused", preserveId: true },
"ul"
);
export default function TCFI_2({ className, data }) { export default function TCFI_2({ className, data }) {
console.log("##data", data); useEffect(() => {
if (data) {
const productInfos = data[0].productInfos[0];
const id = productInfos.prdtId;
Spotlight.focus("spotlight" + id);
}
}, [data]);
return ( return (
<> <>
{data && {data &&
@@ -19,16 +33,19 @@ export default function TCFI_2({ className, data }) {
<div className={css.fullImg}> <div className={css.fullImg}>
<img src={bgImgPath} alt={curationNm} /> <img src={bgImgPath} alt={curationNm} />
</div> </div>
<ul className={css.itemList}> <Container className={css.itemList}>
{productInfos && {productInfos &&
productInfos.slice(0, 2).map(({ imgUrl, prdtNm, prdtId }) => { productInfos.slice(0, 2).map(({ imgUrl, prdtNm, prdtId }) => {
return ( return (
<SpottableComponent key={prdtId}> <SpottableComponent
key={prdtId}
spotlightId={"spotlight" + prdtId}
>
<img src={imgUrl} alt={prdtNm} /> <img src={imgUrl} alt={prdtNm} />
</SpottableComponent> </SpottableComponent>
); );
})} })}
</ul> </Container>
</div> </div>
); );
})} })}

View File

@@ -1,15 +1,26 @@
import React from 'react'; import React, { useEffect } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import Spotlight from '@enact/spotlight';
import SpotlightContainerDecorator
from '@enact/spotlight/SpotlightContainerDecorator';
import Spottable from '@enact/spotlight/Spottable'; import Spottable from '@enact/spotlight/Spottable';
import css from './TCFI_3.module.less'; import css from './TCFI_3.module.less';
const SpottableComponent = Spottable("li"); const SpottableComponent = Spottable("li");
const Container = SpotlightContainerDecorator(
{ enterTo: "last-focused", preserveId: true },
"ul"
);
export default function TCFI_3({ className, data }) { export default function TCFI_3({ className, data }) {
console.log("##data", data); useEffect(() => {
if (data) {
const productInfos = data[0].productInfos[0].prdtId;
Spotlight.focus("spotlight" + productInfos);
}
}, [data]);
return ( return (
<> <>
{data && {data &&
@@ -19,16 +30,19 @@ export default function TCFI_3({ className, data }) {
<div className={css.fullImg}> <div className={css.fullImg}>
<img src={bgImgPath} alt={curationNm} /> <img src={bgImgPath} alt={curationNm} />
</div> </div>
<ul className={css.itemList}> <Container className={css.itemList}>
{productInfos && {productInfos &&
productInfos.slice(0, 3).map(({ imgUrl, prdtNm, prdtId }) => { productInfos.slice(0, 3).map(({ imgUrl, prdtNm, prdtId }) => {
return ( return (
<SpottableComponent key={prdtId}> <SpottableComponent
key={prdtId}
spotlightId={"spotlight" + prdtId}
>
<img src={imgUrl} alt={prdtNm} /> <img src={imgUrl} alt={prdtNm} />
</SpottableComponent> </SpottableComponent>
); );
})} })}
</ul> </Container>
</div> </div>
); );
})} })}

View File

@@ -1,3 +1,4 @@
// @@@ 포커스 처리 남음
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
@@ -10,17 +11,16 @@ import Spottable from '@enact/spotlight/Spottable';
import css from './TCFI_4.module.less'; import css from './TCFI_4.module.less';
const SpottableComponent = Spottable("li"); const SpottableComponent = Spottable("li");
const Container = SpotlightContainerDecorator( const Container = SpotlightContainerDecorator(
{ enterTo: "last-focused", preserveId: true }, { enterTo: "last-focused", preserveId: true },
"ul" "ul"
); );
export default function TCFI_4({ className, data }) { export default function TCFI_4({ className, data }) {
useEffect(() => { useEffect(() => {
if (data) { if (data) {
const productInfos = data[0]?.productInfos[0]; const productInfos = data[0].productInfos[0].prdtId;
const id = productInfos.prdtId; Spotlight.focus("spotlight" + productInfos);
Spotlight.focus("spotlight" + id);
} }
}, [data]); }, [data]);
return ( return (
@@ -34,7 +34,7 @@ export default function TCFI_4({ className, data }) {
</div> </div>
<Container className={css.itemList}> <Container className={css.itemList}>
{productInfos && {productInfos &&
productInfos.slice(0, 2).map(({ imgUrl, prdtNm, prdtId }) => { productInfos.slice(0, 4).map(({ imgUrl, prdtNm, prdtId }) => {
return ( return (
<SpottableComponent <SpottableComponent
key={prdtId} key={prdtId}
@@ -45,16 +45,6 @@ export default function TCFI_4({ className, data }) {
); );
})} })}
</Container> </Container>
<Container className={css.itemList}>
{productInfos &&
productInfos.slice(2, 4).map(({ imgUrl, prdtNm, prdtId }) => {
return (
<SpottableComponent key={prdtId}>
<img src={imgUrl} alt={prdtNm} />
</SpottableComponent>
);
})}
</Container>
</div> </div>
); );
})} })}

View File

@@ -2,10 +2,11 @@
@import "../../../../style/utils.module.less"; @import "../../../../style/utils.module.less";
.itemList { .itemList {
width: 524px; width: 50%;
right: 120px;
bottom: 180px;
flex-wrap: wrap; flex-wrap: wrap;
padding: 0 120px 0 256px;
right: 0;
bottom: 190px;
> li { > li {
margin: 10px; margin: 10px;
> img { > img {

View File

@@ -1,26 +1,37 @@
import React from 'react'; import React, { useEffect } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import Spotlight from '@enact/spotlight';
import Spottable from '@enact/spotlight/Spottable'; import Spottable from '@enact/spotlight/Spottable';
import css from './TCFV.module.less'; import css from './TCFV.module.less';
const SpottableComponent = Spottable("li"); const SpottableComponent = Spottable("li");
const SpottableComponentDiv = Spottable("div");
export default function TCFV({ className, data }) { export default function TCFV({ className, data }) {
console.log("##data", data); useEffect(() => {
Spotlight.focus("spotData");
}, [data]);
return ( return (
<> <>
{data && {data &&
data.map(({ bgImgPath, curationNm, tmpltCd, showInfos }) => { data.map(({ bgImgPath, curationNm, tmpltCd, showInfos }) => {
return ( return (
<div key={tmpltCd} className={classNames(className && className)}> <div key={tmpltCd} className={classNames(className && className)}>
<div className={css.fullImg}> <SpottableComponentDiv
className={css.fullImg}
spotlightId="spotData"
>
<img src={bgImgPath} alt={curationNm} /> <img src={bgImgPath} alt={curationNm} />
</div> </SpottableComponentDiv>
<ul className={css.itemList}> <ul className={css.itemList}>
{showInfos && <SpottableComponent>
<img src={bgImgPath} alt={curationNm} />
{/* <video src={showUrl}></video> */}
</SpottableComponent>
{/* {showInfos &&
showInfos showInfos
.slice(0, 1) .slice(0, 1)
.map( .map(
@@ -34,12 +45,11 @@ export default function TCFV({ className, data }) {
// @@@ 영상 출력 처리 // @@@ 영상 출력 처리
return ( return (
<SpottableComponent key={showId}> <SpottableComponent key={showId}>
<img src={thumbnailUrl} alt={showNm} /> <video src={showUrl}></video>
{/* <video src={showUrl}></video> */}
</SpottableComponent> </SpottableComponent>
); );
} }
)} )} */}
</ul> </ul>
</div> </div>
); );

View File

@@ -1,6 +1,15 @@
@import "../../../../style/CommonStyle.module.less"; @import "../../../../style/CommonStyle.module.less";
@import "../../../../style/utils.module.less"; @import "../../../../style/utils.module.less";
.fullImg {
position: relative;
&:focus-within {
&::after {
.focused();
}
}
}
.itemList { .itemList {
right: 180px; right: 180px;
bottom: 298px; bottom: 298px;

View File

@@ -18,9 +18,8 @@ const Container = SpotlightContainerDecorator(
export default function TCFV_2({ className, data }) { export default function TCFV_2({ className, data }) {
useEffect(() => { useEffect(() => {
if (data) { if (data) {
const showInfos = data[0]?.showInfos[0]; const showInfos = data[0].showInfos[0].showId;
const id = showInfos.showId; Spotlight.focus("spotlight" + showInfos);
Spotlight.focus("spotlight" + id);
} }
}, [data]); }, [data]);
return ( return (

View File

@@ -1,15 +1,28 @@
import React from 'react'; import React, { useEffect } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import Spotlight from '@enact/spotlight';
import SpotlightContainerDecorator
from '@enact/spotlight/SpotlightContainerDecorator';
import Spottable from '@enact/spotlight/Spottable'; import Spottable from '@enact/spotlight/Spottable';
import css from './TCFV_3.module.less'; import css from './TCFV_3.module.less';
const SpottableComponent = Spottable("li"); const SpottableComponent = Spottable("li");
const SpottableComponentDiv = Spottable("div");
const Container = SpotlightContainerDecorator(
{ enterTo: "last-focused", preserveId: true },
"ul"
);
const ContainerDiv = SpotlightContainerDecorator(
{ enterTo: "last-focused", preserveId: true },
"div"
);
export default function TCFV_3({ className, data }) { export default function TCFV_3({ className, data }) {
console.log("##data", data); useEffect(() => {
Spotlight.focus("spotData");
}, [data]);
return ( return (
<> <>
{data && {data &&
@@ -20,7 +33,7 @@ export default function TCFV_3({ className, data }) {
key={tmpltCd} key={tmpltCd}
className={classNames(className && className, css.flexCont)} className={classNames(className && className, css.flexCont)}
> >
<div className={css.fullImg}> <ContainerDiv className={css.fullImg}>
{showInfos && {showInfos &&
showInfos showInfos
.slice(0, 1) .slice(0, 1)
@@ -34,19 +47,22 @@ export default function TCFV_3({ className, data }) {
}) => { }) => {
// @@@ 영상 출력 처리 // @@@ 영상 출력 처리
return ( return (
<SpottableComponent key={showId}> <SpottableComponentDiv
key={showId}
spotlightId="spotData"
>
<img <img
src={thumbnailUrl} src={thumbnailUrl}
alt={showNm} alt={showNm}
className={css.video} className={css.video}
/> />
{/* <video src={showUrl}></video> */} {/* <video src={showUrl}></video> */}
</SpottableComponent> </SpottableComponentDiv>
); );
} }
)} )}
</div> </ContainerDiv>
<ul className={css.itemList}> <Container className={css.itemList}>
{productInfos && {productInfos &&
productInfos productInfos
.slice(0, 4) .slice(0, 4)
@@ -57,7 +73,7 @@ export default function TCFV_3({ className, data }) {
</SpottableComponent> </SpottableComponent>
); );
})} })}
</ul> </Container>
</div> </div>
); );
} }

View File

@@ -7,6 +7,12 @@
justify-content: space-between; justify-content: space-between;
> div { > div {
width: 1414px; width: 1414px;
position: relative;
&:focus-within {
&::after {
.focused();
}
}
} }
} }
.itemList { .itemList {

View File

@@ -1,15 +1,27 @@
import React from 'react'; import React, { useEffect } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import Spotlight from '@enact/spotlight';
import SpotlightContainerDecorator
from '@enact/spotlight/SpotlightContainerDecorator';
import Spottable from '@enact/spotlight/Spottable'; import Spottable from '@enact/spotlight/Spottable';
import css from './TCFV_4.module.less'; import css from './TCFV_4.module.less';
const Container = SpotlightContainerDecorator(
{ enterTo: "last-focused", preserveId: true },
"ul"
);
const SpottableComponent = Spottable("li"); const SpottableComponent = Spottable("li");
export default function TCFV_4({ className, data }) { export default function TCFV_4({ className, data }) {
console.log("##data", data); useEffect(() => {
if (data) {
Spotlight.focus("spotData");
}
}, [data]);
return ( return (
<> <>
{data && {data &&
@@ -20,8 +32,8 @@ export default function TCFV_4({ className, data }) {
<div className={css.fullImg}> <div className={css.fullImg}>
<img src={bgImgPath} alt={curationNm} /> <img src={bgImgPath} alt={curationNm} />
</div> </div>
<ul className={css.itemList}> <Container className={css.itemList}>
{showInfos && {/* {showInfos &&
showInfos showInfos
.slice(0, 1) .slice(0, 1)
.map( .map(
@@ -34,18 +46,28 @@ export default function TCFV_4({ className, data }) {
}) => { }) => {
// @@@ 영상 출력 처리 // @@@ 영상 출력 처리
return ( return (
<SpottableComponent key={showId}> <SpottableComponent
key={showId}
spotlightId="spotData"
>
<img <img
src={thumbnailUrl} src={bgImgPath}
alt={showNm} alt={curationNm}
className={css.video} className={css.video}
/> />
{/* <video src={showUrl}></video> */}
</SpottableComponent> </SpottableComponent>
); );
} }
)} )}
*/}
<SpottableComponent spotlightId="spotData">
<img
src={bgImgPath}
alt={curationNm}
className={css.video}
/>
</SpottableComponent>
{productInfos && {productInfos &&
productInfos productInfos
.slice(0, 4) .slice(0, 4)
@@ -56,7 +78,7 @@ export default function TCFV_4({ className, data }) {
</SpottableComponent> </SpottableComponent>
); );
})} })}
</ul> </Container>
</div> </div>
); );
} }

View File

@@ -38,9 +38,7 @@ export default function TCHH({ className, data }) {
key={idx} key={idx}
spotlightId={"spotlight" + idx} spotlightId={"spotlight" + idx}
> >
<p>
<img src={bgImgPath} alt={curationNm} /> <img src={bgImgPath} alt={curationNm} />
</p>
</SpottableComponent> </SpottableComponent>
); );
})} })}

View File

@@ -4,13 +4,15 @@
.halfWrap { .halfWrap {
> div { > div {
display: flex; display: flex;
justify-content: space-between !important;
> div { > div {
display: flex; width: 855px;
justify-content: center; height: 900px;
flex: 1;
&:focus-within {
> p {
position: relative; position: relative;
display: flex;
align-items: center;
justify-content: center;
&:focus-within {
&::after { &::after {
.focused(); .focused();
} }
@@ -18,4 +20,3 @@
} }
} }
} }
}