featured Bradns focus && selected 작업 완료

This commit is contained in:
고동영
2024-02-08 10:42:10 +09:00
parent 2df9f436bc
commit 7d11a6c0e2
6 changed files with 145 additions and 95 deletions

View File

@@ -22,13 +22,10 @@ const TabItemBase = ({
isSubItem, isSubItem,
onFocus, onFocus,
showSubTab = false, showSubTab = false,
temp,
setTemp,
mainSelectedIndex, mainSelectedIndex,
...rest ...rest
}) => { }) => {
const [focused, setFocused] = useState(false); const [focused, setFocused] = useState(false);
const [fixed, setFixed] = useState(false);
const clearPressedJob = useRef( const clearPressedJob = useRef(
new Job((func) => { new Job((func) => {
setTimeout(func, 100); setTimeout(func, 100);
@@ -96,8 +93,6 @@ const TabItemBase = ({
className={classNames( className={classNames(
css.tabItem, css.tabItem,
(focused || index === mainSelectedIndex) && css.focused, (focused || index === mainSelectedIndex) && css.focused,
// focused && css.focused,
showSubTab && fixed && css.fixed,
!isSubItem && !isSubItem &&
(focused || index === mainSelectedIndex) && (focused || index === mainSelectedIndex) &&
showSubTab && showSubTab &&
@@ -124,7 +119,6 @@ const TabItemBase = ({
{title} {title}
</Marquee> </Marquee>
)} )}
{/* <TabItemSub /> */}
</div> </div>
</SpottableComponent> </SpottableComponent>
); );

View File

@@ -38,26 +38,6 @@
color: #eee; color: #eee;
} }
&.fixed {
color: #eee;
background: linear-gradient(to right, #cb1253, #e15ba1);
border-radius: 42px;
width: 402px;
z-index: 1;
margin-left: 30px;
position:relative;
&.arrow {
&::after {
content: "";
.size(@w:36px, @h:36px);
.position(@position: absolute, @top: 24px, @right: 18px);
background-image: url('../../../assets/icons/ic-lnb-right-arrow.png');
background-size: 36px 36px;
}
}
}
.itemWrap { .itemWrap {
display: flex; display: flex;

View File

@@ -11,19 +11,17 @@ import css from "./TabItemSub.module.less";
const SpottableComponent = Spottable("div"); const SpottableComponent = Spottable("div");
const TabItemBase = ({ const TabItemBase = ({
title,
expanded = false,
selected = false, selected = false,
expanded = false,
index = 0, index = 0,
title,
target, target,
deActivateTab, deActivateTab,
onClick, onClick,
lgCatCd, lgCatCd,
isSubItem, isSubItem,
onFocus, onFocus,
onBlur,
path, path,
subTitle,
...rest ...rest
}) => { }) => {
const [focused, setFocused] = useState(false); const [focused, setFocused] = useState(false);
@@ -54,10 +52,6 @@ const TabItemBase = ({
const _onBlur = useCallback(() => { const _onBlur = useCallback(() => {
setFocused(false); setFocused(false);
if (onBlur) {
onBlur(index);
}
}, [index]); }, [index]);
const onKeyDown = useCallback( const onKeyDown = useCallback(
@@ -71,12 +65,19 @@ const TabItemBase = ({
const ImageComponent = useCallback(() => { const ImageComponent = useCallback(() => {
return ( return (
<div className={css.imageLayout}> <div
<span className={classNames(css.outline)} /> className={classNames(
css.imageWrap,
focused && css.focused,
selected && css.selected,
focused && selected && css.selectedFocus
)}
>
<img src={path} alt="" /> <img src={path} alt="" />
<span className={classNames(css.outline)} />
</div> </div>
); );
}, [path]); }, [path, focused, selected]);
const TextComponent = useCallback(() => { const TextComponent = useCallback(() => {
return ( return (
@@ -102,20 +103,23 @@ const TabItemBase = ({
css.tabItem, css.tabItem,
!path && focused && css.focused, !path && focused && css.focused,
path && css.path path && css.path
// focused && path && css.imageFocus,
// selected && css.imageSelect
)} )}
onKeyDown={onKeyDown} onKeyDown={onKeyDown}
onFocus={_onFocus} onFocus={_onFocus}
onBlur={_onBlur} onBlur={_onBlur}
onClick={_onClick} onClick={_onClick}
> >
<div className={css.layout}> <div className={classNames(isSubItem && css.subWrap)}>
<div className={classNames(isSubItem && css.subWrap)}> {!path && (
{!path && <span className={css[`category-icon-${lgCatCd}`]} />} <span
{path ? <ImageComponent /> : <TextComponent />} className={classNames(
</div> css.icon,
focused && css.focused,
css[`category-icon-${lgCatCd}`]
)}
/>
)}
{path ? <ImageComponent /> : <TextComponent />}
</div> </div>
</SpottableComponent> </SpottableComponent>
); );

View File

@@ -12,7 +12,7 @@
position: relative; position: relative;
padding-left: 42px; padding-left: 42px;
padding-right: 24px; padding-right: 24px;
&.focused { &.focused {
background: rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .1);
@@ -32,43 +32,59 @@
color: #eee; color: #eee;
} }
.imageWrap {
.imageLayout { position: relative;
&.outline { margin:0 30px 0 48px;
.position(@position: absolute, @top: 0, @right: auto, @bottom: auto, @left: 0); img {
.size(@w: 138px, @h:138px);
background-position: center;
background-size: cover;
> img {
.size(@w: 120px, @h: 120px); .size(@w: 120px, @h: 120px);
} object-fit: contain;
}
&.imageFocus {
.outline {
.focusDropShadow();
border-radius: 60px;
z-index: 99;
background-image: url("../../../assets/icons/ic-tab-partners-focus@3x.png");
// box-shadow: -3px 0px 30px 0 #c70850;
// border: solid 1px #dadada;
> img {
.size(@w: 138px, @h: 138px);
}
}
}
// &.ImgSelect {
// img {
// .size(@w: 138px, @h: 138px);
// }
// .outline {
// background-image: url("../../../assets/icons/ic-tab-partners-lnb-selected@3x.png");
// }
// }
} }
span {
.position(@position: absolute, @top: 0, @right: 0, @bottom: 0, @left: 0);
.size(@w: 140px, @h: 140px);
background-position: center;
background-size: cover;
}
&.focused {
img {
box-shadow: -3px 0px 30px 0 #c70850;
border-radius: 37%;
.size(@w: 138px, @h: 138px);
object-fit: contain;
}
span {
background-image: url('../../../assets/icons/ic-tab-partners-focus@3x.png');
}
}
&.selected {
img {
.size(@w: 138px, @h: 138px);
object-fit: contain;
}
span {
background-image: url('../../../assets/icons/ic-tab-partners-lnb-selected@3x.png');
}
}
&.selectedFocus {
img {
box-shadow: -3px 0px 30px 0 #808080;
border-radius: 37%;
}
}
}
.text { .text {
line-height: 1.2; line-height: 1.2;
@@ -81,10 +97,11 @@
} }
} }
.subWrap{ .subWrap{
.flex(); .flex();
span { .icon {
.size(@w: 40px, @h:40px); .size(@w: 40px, @h:40px);
background-size: cover; background-size: cover;
&.category-icon-1017 { &.category-icon-1017 {
@@ -151,6 +168,69 @@
&.category-icon-1013 { &.category-icon-1013 {
background-image: url("../../../assets/icons/ic-category-clearance-nor.png"); background-image: url("../../../assets/icons/ic-category-clearance-nor.png");
} }
&.focused {
// LG Electronics
&.category-icon-1017 {
background-image: url("../../../assets/category/ic-category-lgelectronics-nor@3x.png");
}
// Garden and Outdoors
&.category-icon-1008 {
background-image: url("../../../assets/category/ic-category-garden-nor@3x.png");
}
// Fashion
&.category-icon-1000 {
background-image: url("../../../assets/category/ic-category-fashion-nor@3x.png");
}
// Beauty
&.category-icon-1003 {
background-image: url("../../../assets/category/ic-category-beauty-nor@3x.png");
}
// Jewelry
&.category-icon-1004 {
background-image: url("../../../assets/category/ic-category-jewelry-nor@3x.png");
}
// Home
&.category-icon-1006 {
background-image: url("../../../assets/category/ic-category-home-nor@3x.png");
}
// Kitchen & Food
&.category-icon-1007 {
background-image: url("../../../assets/category/ic-category-kitchen-nor@3x.png");
}
// Accessories
&.category-icon-1014 {
background-image: url("../../../assets/category/ic-category-accessories-nor@3x.png");
}
// Heaclth & Fitness
&.category-icon-1009 {
background-image: url("../../../assets/category/ic-category-health-nor@3x.png");
}
// Crafts & Sewing
&.category-icon-1011 {
background-image: url("../../../assets/category/ic-category-cw-nor@3x.png");
}
// Electronics
&.category-icon-1010 {
background-image: url("../../../assets/category/ic-category-electronics-nor@3x.png");
}
// Clearance
&.category-icon-1013 {
background-image: url("../../../assets/category/ic-category-clearance-nor@3x.png");
}
}
} }
} }

View File

@@ -506,8 +506,6 @@ export default function TabLayout({ topPanelName, onTabActivated }) {
showSubTab={showSubTab} showSubTab={showSubTab}
icons={item.icons} icons={item.icons}
expanded={mainExpanded} expanded={mainExpanded}
temp={temp}
setTemp={setTemp}
selected={ selected={
(panels.length === 0 && index === 0) || (panels.length === 0 && index === 0) ||
(Array.isArray(item.target) && (Array.isArray(item.target) &&
@@ -540,7 +538,6 @@ export default function TabLayout({ topPanelName, onTabActivated }) {
return ( return (
<TabItemSub <TabItemSub
{...item} {...item}
onBlur={onBlur}
key={"tabitemSubmenu" + index} key={"tabitemSubmenu" + index}
onClick={onClickSubItem} onClick={onClickSubItem}
expanded={true} expanded={true}
@@ -551,12 +548,12 @@ export default function TabLayout({ topPanelName, onTabActivated }) {
lgCatCd={item.id} lgCatCd={item.id}
path={item.path} path={item.path}
showSubTab={showSubTab} showSubTab={showSubTab}
// selected={ selected={
// (panels.length === 0 && index === 0) || (panels.length === 0 && index === 0) ||
// (Array.isArray(item.target) && (Array.isArray(item.target) &&
// item.target[0]?.name && item.target[0]?.panelInfo &&
// panels[0]?.name === item.target[0]?.name) panels[0]?.panelInfo === item.target[0]?.panelInfo)
// } }
/> />
); );
})} })}

View File

@@ -71,11 +71,6 @@
&.secondDepthReduce { &.secondDepthReduce {
width: 216px; width: 216px;
// transition: width 0.5s ease;
// > div {
// margin-bottom: 90px;
// }
} }
} }