subDepth icon 추가 및 tabLayout css 수정
|
After Width: | Height: | Size: 794 B |
BIN
com.twin.app.shoptime/assets/icons/ic-category-beauty-nor.png
Normal file
|
After Width: | Height: | Size: 420 B |
BIN
com.twin.app.shoptime/assets/icons/ic-category-clearance-nor.png
Normal file
|
After Width: | Height: | Size: 909 B |
BIN
com.twin.app.shoptime/assets/icons/ic-category-cw-nor.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 299 B |
BIN
com.twin.app.shoptime/assets/icons/ic-category-enter-nor.png
Normal file
|
After Width: | Height: | Size: 727 B |
BIN
com.twin.app.shoptime/assets/icons/ic-category-fashion-nor.png
Normal file
|
After Width: | Height: | Size: 585 B |
BIN
com.twin.app.shoptime/assets/icons/ic-category-garden-nor.png
Normal file
|
After Width: | Height: | Size: 751 B |
BIN
com.twin.app.shoptime/assets/icons/ic-category-health-nor.png
Normal file
|
After Width: | Height: | Size: 571 B |
BIN
com.twin.app.shoptime/assets/icons/ic-category-home-nor.png
Normal file
|
After Width: | Height: | Size: 534 B |
BIN
com.twin.app.shoptime/assets/icons/ic-category-jewelry-nor.png
Normal file
|
After Width: | Height: | Size: 866 B |
BIN
com.twin.app.shoptime/assets/icons/ic-category-kitchen-nor.png
Normal file
|
After Width: | Height: | Size: 522 B |
BIN
com.twin.app.shoptime/assets/icons/ic-lnb-right-arrow.png
Normal file
|
After Width: | Height: | Size: 333 B |
@@ -1,10 +1,13 @@
|
|||||||
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||||
|
|
||||||
|
import classNames from "classnames";
|
||||||
|
import compose from "ramda/src/compose";
|
||||||
|
|
||||||
import { Job } from "@enact/core/util";
|
import { Job } from "@enact/core/util";
|
||||||
import { Marquee, MarqueeController } from "@enact/sandstone/Marquee";
|
import { Marquee, MarqueeController } from "@enact/sandstone/Marquee";
|
||||||
import Spottable from "@enact/spotlight/Spottable";
|
import Spottable from "@enact/spotlight/Spottable";
|
||||||
import { getTargetByDirectionFromElement } from "@enact/spotlight/src/target";
|
import { getTargetByDirectionFromElement } from "@enact/spotlight/src/target";
|
||||||
import classNames from "classnames";
|
|
||||||
import compose from "ramda/src/compose";
|
|
||||||
import { useCallback, useMemo, useRef, useState } from "react";
|
|
||||||
import css from "./TabItem.module.less";
|
import css from "./TabItem.module.less";
|
||||||
|
|
||||||
const SpottableComponent = Spottable("div");
|
const SpottableComponent = Spottable("div");
|
||||||
@@ -19,42 +22,52 @@ const TabItemBase = ({
|
|||||||
deActivateTab,
|
deActivateTab,
|
||||||
className,
|
className,
|
||||||
onClick,
|
onClick,
|
||||||
|
mainExpandend,
|
||||||
|
lgCatCd,
|
||||||
|
isSubItem,
|
||||||
|
subTitle,
|
||||||
|
showSubTab = false,
|
||||||
...rest
|
...rest
|
||||||
}) => {
|
}) => {
|
||||||
const [focused, setFocused] = useState(false);
|
const [focused, setFocused] = useState(false);
|
||||||
|
// const [subFocused , setSubFocused] = useState(false)
|
||||||
|
const [pressed, setPressed] = useState(false);
|
||||||
const itemRef = useRef();
|
const itemRef = useRef();
|
||||||
|
|
||||||
const clearPressedJob = useRef(
|
const clearPressedJob = useRef(
|
||||||
new Job((func) => {
|
new Job((func) => {
|
||||||
// setPressed(false);
|
|
||||||
setTimeout(func, 100);
|
setTimeout(func, 100);
|
||||||
}, 100)
|
}, 100)
|
||||||
);
|
);
|
||||||
const _onClick = useCallback(
|
const _onClick = useCallback(
|
||||||
(ev) => {
|
(ev) => {
|
||||||
// if(ev?.target?.nodeName === 'IMG'){
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
clearPressedJob.current.start(() => {
|
clearPressedJob.current.start(() => {
|
||||||
if (onClick) {
|
if (onClick) {
|
||||||
onClick({ index, target });
|
onClick({ index, target });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setPressed(true);
|
||||||
|
|
||||||
onClick({ index, target });
|
onClick({ index, target });
|
||||||
},
|
},
|
||||||
[target, index, onClick]
|
[target, index, onClick, isSubItem]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
useEffect(() => {}, [pressed]);
|
||||||
|
|
||||||
const _onFocus = useCallback(() => {
|
const _onFocus = useCallback(() => {
|
||||||
setFocused(true);
|
setFocused(true);
|
||||||
}, [index]);
|
}, [index]);
|
||||||
|
|
||||||
const _onBlur = useCallback(() => {
|
const _onBlur = useCallback(() => {
|
||||||
setFocused(false);
|
setFocused(false);
|
||||||
}, []);
|
}, [focused]);
|
||||||
|
|
||||||
const isDivider = useMemo(() => {
|
const isDivider = useMemo(() => {
|
||||||
return !title;
|
return !title;
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const onKeyDown = useCallback(
|
const onKeyDown = useCallback(
|
||||||
(event) => {
|
(event) => {
|
||||||
if (event.key === "ArrowRight") {
|
if (event.key === "ArrowRight") {
|
||||||
@@ -69,14 +82,27 @@ const TabItemBase = ({
|
|||||||
},
|
},
|
||||||
[deActivateTab]
|
[deActivateTab]
|
||||||
);
|
);
|
||||||
|
|
||||||
const renderIcon = useCallback(() => {
|
const renderIcon = useCallback(() => {
|
||||||
if (icons) {
|
if (icons) {
|
||||||
const Component = icons;
|
const Component = icons;
|
||||||
return <Component iconType={focused ? "expanded" : "normal"} />;
|
return (
|
||||||
|
<Component
|
||||||
|
iconType={
|
||||||
|
focused
|
||||||
|
? "focused"
|
||||||
|
: selected
|
||||||
|
? "selected"
|
||||||
|
: expanded
|
||||||
|
? "expanded"
|
||||||
|
: "normal"
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}, [focused, selected, expanded]);
|
}, [focused, expanded]);
|
||||||
|
|
||||||
delete rest.hasChildren;
|
delete rest.hasChildren;
|
||||||
delete rest.getChildren;
|
delete rest.getChildren;
|
||||||
@@ -85,8 +111,11 @@ const TabItemBase = ({
|
|||||||
ref={itemRef}
|
ref={itemRef}
|
||||||
className={classNames(
|
className={classNames(
|
||||||
css.tabItem,
|
css.tabItem,
|
||||||
focused && css.focused
|
focused && css.focused,
|
||||||
//!isDivider && selected && css.selected
|
pressed && css.pressed,
|
||||||
|
isSubItem && css.subDepth,
|
||||||
|
pressed && css.arrow,
|
||||||
|
!isDivider && selected && css.selected
|
||||||
)}
|
)}
|
||||||
onKeyDown={onKeyDown}
|
onKeyDown={onKeyDown}
|
||||||
onFocus={_onFocus}
|
onFocus={_onFocus}
|
||||||
@@ -94,13 +123,21 @@ const TabItemBase = ({
|
|||||||
onClick={_onClick}
|
onClick={_onClick}
|
||||||
spotlightDisabled={isDivider}
|
spotlightDisabled={isDivider}
|
||||||
>
|
>
|
||||||
|
<div className={classNames(css.layout, focused && css.focused)}>
|
||||||
{icons && <div className={css.icon}>{renderIcon()}</div>}
|
{icons && <div className={css.icon}>{renderIcon()}</div>}
|
||||||
|
<div className={classNames(isSubItem && css.subWrap)}>
|
||||||
|
<span className={classNames(css[`category-icon-${lgCatCd}`])} />
|
||||||
|
|
||||||
{expanded && title && (
|
{expanded && (
|
||||||
<Marquee marqueeOn={"focus"} className={classNames(css.text)}>
|
<Marquee
|
||||||
|
marqueeOn={"focus"}
|
||||||
|
className={classNames(css.text, isSubItem && css.subItem)}
|
||||||
|
>
|
||||||
{title}
|
{title}
|
||||||
</Marquee>
|
</Marquee>
|
||||||
)}
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</SpottableComponent>
|
</SpottableComponent>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,19 +1,74 @@
|
|||||||
|
@import "../../style/utils.module.less";
|
||||||
|
@import "../../style/CommonStyle.module.less";
|
||||||
|
|
||||||
@ICON_SIZE: 48px;
|
@ICON_SIZE: 48px;
|
||||||
|
|
||||||
.tabItem{
|
.tabItem{
|
||||||
padding: 18px 12px 18px 42px;
|
|
||||||
font-size: 36px;
|
font-size: 36px;
|
||||||
display: flex;
|
display: flex;
|
||||||
color: #606060;
|
color: #606060;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
height: 84px;
|
||||||
|
|
||||||
|
padding-left: 42px;
|
||||||
|
padding-right: 24px;
|
||||||
|
|
||||||
&.focused {
|
&.focused {
|
||||||
color: #eee;
|
color: #eee;
|
||||||
background: linear-gradient(#cb1253, #e15ba1);
|
background: linear-gradient(to right, #cb1253, #e15ba1);
|
||||||
border-radius: 42px;
|
border-radius: 42px;
|
||||||
width: 402px;
|
width: 402px;
|
||||||
|
z-index: 1;
|
||||||
|
margin-left: 30px;
|
||||||
|
position:relative;
|
||||||
|
> div{
|
||||||
|
margin-left:-30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.pressed {
|
||||||
|
color: #eee;
|
||||||
|
background: linear-gradient(to right, #cb1253, #e15ba1);
|
||||||
|
border-radius: 42px;
|
||||||
|
width: 402px;
|
||||||
|
z-index: 1;
|
||||||
|
margin-left: 30px;
|
||||||
|
position:relative;
|
||||||
|
}
|
||||||
|
&.selected{
|
||||||
|
// margin-left:0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.arrow, &.selected {
|
||||||
|
&::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;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.selected {
|
||||||
|
color: #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.subDepth{
|
||||||
|
width: 386px;
|
||||||
|
height: 78px;
|
||||||
|
margin-left: 0;
|
||||||
|
|
||||||
|
&.focused {
|
||||||
|
background: rgba(255, 255, 255, .1);
|
||||||
|
border-radius: 0px;
|
||||||
|
border-right: 6px solid #c70850;
|
||||||
|
> div {
|
||||||
|
padding-left: 30px;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}}}
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
position: relative;
|
position: relative;
|
||||||
@@ -39,15 +94,107 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.text {
|
.text {
|
||||||
width: 100%;
|
line-height: 1.2;
|
||||||
line-height: 36px;
|
padding-left: 11px;
|
||||||
padding-left: 18px;
|
.font(@fontFamily:@baseFontBold, @fontSize:36px);
|
||||||
padding-top: 6px;
|
|
||||||
flex-grow: 1;
|
|
||||||
flex-shrink: 1;
|
|
||||||
overflow: hidden;
|
&.subItem {
|
||||||
|
.font (@fontFamily:@baseFontBold, @fontSize:30px);
|
||||||
|
width: 245px;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.subWrap{
|
||||||
|
.flex();
|
||||||
|
|
||||||
|
|
||||||
|
span {
|
||||||
|
.size(@w: 40px, @h:40px);
|
||||||
|
background-size: cover;
|
||||||
|
&.category-icon-1017 {
|
||||||
|
// LG Electronics
|
||||||
|
background-image: url("../../../assets/category/ic-category-lgelectronics-nor@3x.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Garden and Outdoors
|
||||||
|
&.category-icon-1008 {
|
||||||
|
background-image: url("../../../assets/icons/ic-category-garden-nor.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fashion
|
||||||
|
&.category-icon-1000 {
|
||||||
|
background-image: url("../../../assets/icons/ic-category-fashion-nor.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Beauty
|
||||||
|
&.category-icon-1003 {
|
||||||
|
background-image: url("../../../assets/icons/ic-category-beauty-nor.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Jewelry
|
||||||
|
&.category-icon-1004 {
|
||||||
|
background-image: url("../../../assets/icons/ic-category-jewelry-nor.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Home
|
||||||
|
&.category-icon-1006 {
|
||||||
|
background-image: url("../../../assets/icons/ic-category-home-nor.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Kitchen & Food
|
||||||
|
&.category-icon-1007 {
|
||||||
|
background-image: url("../../../assets/icons/ic-category-kitchen-nor.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Accessories
|
||||||
|
&.category-icon-1014 {
|
||||||
|
background-image: url("../../../assets/icons/ic-category-accessories-nor.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Heaclth & Fitness
|
||||||
|
&.category-icon-1009 {
|
||||||
|
background-image: url("../../../assets/icons/ic-category-health-nor.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Entertainment
|
||||||
|
&.category-icon-1012 {
|
||||||
|
background-image: url("../../../assets/icons/ic-category-enter-nor.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Crafts & Sewing
|
||||||
|
&.category-icon-1011 {
|
||||||
|
background-image: url("../../../assets/icons/ic-category-cw-nor.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Electronics
|
||||||
|
&.category-icon-1010 {
|
||||||
|
background-image: url("../../../assets/icons/ic-category-electronics-nor.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clearance
|
||||||
|
&.category-icon-1013 {
|
||||||
|
background-image: url("../../../assets/icons/ic-category-clearance-nor.png");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.layout {
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
&.focused, &.selected {
|
||||||
|
// margin-left: -30px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.marqueeWrap {
|
.marqueeWrap {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,20 +9,19 @@ import React, {
|
|||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
import { panel_names } from "../../utils/Config";
|
//아이콘
|
||||||
import TabItem from "./TabItem";
|
import { Job } from "@enact/core/util";
|
||||||
import css from "./TabLayout.module.less";
|
|
||||||
//enact
|
//enact
|
||||||
import Skinnable from "@enact/sandstone/Skinnable";
|
import Skinnable from "@enact/sandstone/Skinnable";
|
||||||
import Spotlight from "@enact/spotlight";
|
import Spotlight from "@enact/spotlight";
|
||||||
import SpotlightContainerDecorator from "@enact/spotlight/SpotlightContainerDecorator";
|
import SpotlightContainerDecorator from "@enact/spotlight/SpotlightContainerDecorator";
|
||||||
import { Cancelable } from "@enact/ui/Cancelable";
|
import { Cancelable } from "@enact/ui/Cancelable";
|
||||||
//아이콘
|
|
||||||
import { Job } from "@enact/core/util";
|
|
||||||
|
|
||||||
//이미지
|
//이미지
|
||||||
import shoptimeFullIcon from "../../../assets/icons/ic-lnb-logo-shoptime@3x.png";
|
import shoptimeFullIcon from "../../../assets/icons/ic-lnb-logo-shoptime@3x.png";
|
||||||
import shopTimeIcon from "../../../assets/icons/ic-lnb-shoptime-symbol@3x.png";
|
import shopTimeIcon from "../../../assets/icons/ic-lnb-shoptime-symbol@3x.png";
|
||||||
|
import { resetPanels } from "../../features/panels/panelsSlice";
|
||||||
|
import { panel_names } from "../../utils/Config";
|
||||||
import CartIcon from "./iconComponents/CartIcon";
|
import CartIcon from "./iconComponents/CartIcon";
|
||||||
import CategoryIcon from "./iconComponents/CategoryIcon";
|
import CategoryIcon from "./iconComponents/CategoryIcon";
|
||||||
import FeaturedBrandIcon from "./iconComponents/FeaturedBrandIcon";
|
import FeaturedBrandIcon from "./iconComponents/FeaturedBrandIcon";
|
||||||
@@ -32,9 +31,8 @@ import MyPageIcon from "./iconComponents/MyPageIcon";
|
|||||||
import OnSaleIcon from "./iconComponents/OnSaleIcon";
|
import OnSaleIcon from "./iconComponents/OnSaleIcon";
|
||||||
import SearchIcon from "./iconComponents/SearchIcon";
|
import SearchIcon from "./iconComponents/SearchIcon";
|
||||||
import TrendingNowIcon from "./iconComponents/TrendingNowIcon";
|
import TrendingNowIcon from "./iconComponents/TrendingNowIcon";
|
||||||
|
import TabItem from "./TabItem";
|
||||||
//이미지
|
import css from "./TabLayout.module.less";
|
||||||
import { resetPanels } from "../../features/panels/panelsSlice";
|
|
||||||
|
|
||||||
const Container = SpotlightContainerDecorator(
|
const Container = SpotlightContainerDecorator(
|
||||||
{ enterTo: "default-element" },
|
{ enterTo: "default-element" },
|
||||||
@@ -52,9 +50,10 @@ const CancelableDiv = Cancelable(
|
|||||||
);
|
);
|
||||||
|
|
||||||
class TabMenuItem {
|
class TabMenuItem {
|
||||||
constructor(icons = "", title = "", target, children = []) {
|
constructor(icons = "", title = "", id, target, children = []) {
|
||||||
this.icons = icons;
|
this.icons = icons;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
|
this.id = id;
|
||||||
this.target = target;
|
this.target = target;
|
||||||
this.children = []; //TabMenuItem
|
this.children = []; //TabMenuItem
|
||||||
if (children && children.length > 0) {
|
if (children && children.length > 0) {
|
||||||
@@ -62,6 +61,7 @@ class TabMenuItem {
|
|||||||
const tabmenu = new TabMenuItem(
|
const tabmenu = new TabMenuItem(
|
||||||
children[i].icons,
|
children[i].icons,
|
||||||
children[i].title,
|
children[i].title,
|
||||||
|
children[i].id,
|
||||||
children[i].target,
|
children[i].target,
|
||||||
children[i].children
|
children[i].children
|
||||||
);
|
);
|
||||||
@@ -110,91 +110,80 @@ export default function TabLayout({ topPanelName, onTabActivated }) {
|
|||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const [mainExpanded, setMainExpanded] = useState(false);
|
const [mainExpanded, setMainExpanded] = useState(false);
|
||||||
const [mainSelectedIndex, setMainSelectedIndex] = useState(-1);
|
const [mainSelectedIndex, setMainSelectedIndex] = useState(-1);
|
||||||
|
const [focused, setFocused] = useState(false);
|
||||||
const [tabs, setTabs] = useState([]);
|
const [tabs, setTabs] = useState([]);
|
||||||
const [tabFocused, setTabFocused] = useState([false, false, false]); //COLLABSED_MAIN, ACTIVATED_MAIN, ACTIVATED_SUB
|
const [tabFocused, setTabFocused] = useState([false, false, false]); //COLLABSED_MAIN, ACTIVATED_MAIN, ACTIVATED_SUB
|
||||||
const panelSwitching = useRef(null);
|
const panelSwitching = useRef(null);
|
||||||
const { cursorVisible } = useSelector((state) => state.common.appStatus);
|
const { cursorVisible } = useSelector((state) => state.common.appStatus);
|
||||||
const data = useSelector((state) => state.home.menuData?.data);
|
const data = useSelector((state) => state.home.menuData?.data);
|
||||||
|
const panels = useSelector((state) => state.panels.panels);
|
||||||
|
|
||||||
const menuItems = useMemo(
|
const menuItems = useMemo(() => {
|
||||||
() => [
|
return [
|
||||||
{
|
{
|
||||||
icons: CategoryIcon,
|
icons: CategoryIcon,
|
||||||
title: "",
|
|
||||||
children: [],
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icons: MyPageIcon,
|
icons: MyPageIcon,
|
||||||
title: "",
|
|
||||||
children: [],
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icons: SearchIcon,
|
icons: SearchIcon,
|
||||||
title: "",
|
|
||||||
target: [{ name: panel_names.SEARCH_PANEL }],
|
target: [{ name: panel_names.SEARCH_PANEL }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icons: HomeIcon,
|
icons: HomeIcon,
|
||||||
title: "",
|
|
||||||
target: [{ name: panel_names.HOME_PANEL }],
|
target: [{ name: panel_names.HOME_PANEL }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icons: FeaturedBrandIcon,
|
icons: FeaturedBrandIcon,
|
||||||
title: "",
|
|
||||||
children: [],
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icons: OnSaleIcon,
|
icons: OnSaleIcon,
|
||||||
title: "",
|
|
||||||
target: [{ name: panel_names.ON_SALE_PANEL }],
|
target: [{ name: panel_names.ON_SALE_PANEL }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icons: TrendingNowIcon,
|
icons: TrendingNowIcon,
|
||||||
title: "",
|
|
||||||
target: [{ name: panel_names.TRENDING_NOW_PANEL }],
|
target: [{ name: panel_names.TRENDING_NOW_PANEL }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icons: HotPicksIcon,
|
icons: HotPicksIcon,
|
||||||
title: "",
|
|
||||||
target: [{ name: panel_names.HOT_PICKS_PANEL }],
|
target: [{ name: panel_names.HOT_PICKS_PANEL }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icons: CartIcon,
|
icons: CartIcon,
|
||||||
title: "",
|
|
||||||
target: [{ name: panel_names.CART_PANEL }],
|
target: [{ name: panel_names.CART_PANEL }],
|
||||||
},
|
},
|
||||||
|
];
|
||||||
//메뉴 추가 필요 20240112 chw
|
}, []);
|
||||||
],
|
|
||||||
[data]
|
|
||||||
);
|
|
||||||
|
|
||||||
const getMenuData = (type) => {
|
const getMenuData = (type) => {
|
||||||
let result = [];
|
let result = [];
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "Category":
|
case "Category":
|
||||||
data?.homeCategory.map((item) => {
|
result = data?.homeCategory.map((item) => ({
|
||||||
result.push(item.lgCatNm);
|
id: item.lgCatCd,
|
||||||
});
|
title: item.lgCatNm,
|
||||||
return result;
|
}));
|
||||||
|
break;
|
||||||
case "GNB":
|
case "GNB":
|
||||||
data?.gnb.map((item) => {
|
result = data?.gnb.map((item) => ({
|
||||||
result.push(item.menuNm);
|
title: item.menuNm,
|
||||||
});
|
}));
|
||||||
return result;
|
break;
|
||||||
|
|
||||||
case "Featured Brands":
|
case "Featured Brands":
|
||||||
data?.shortFeaturedBrands.map((item) => {
|
result = data?.shortFeaturedBrands.map((item) => ({
|
||||||
result.push(item.patncLogoPath);
|
title: item.patncLogoPath,
|
||||||
});
|
}));
|
||||||
return result;
|
break;
|
||||||
case "My Page":
|
case "My Page":
|
||||||
data?.mypage.map((item) => {
|
result = data?.mypage.map((item) => ({
|
||||||
result.push(item.menuNm);
|
title: item.menuNm,
|
||||||
});
|
}));
|
||||||
return result;
|
break;
|
||||||
}
|
}
|
||||||
return null;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
const dataDivide = useCallback(() => {
|
const dataDivide = useCallback(() => {
|
||||||
@@ -216,22 +205,20 @@ export default function TabLayout({ topPanelName, onTabActivated }) {
|
|||||||
Cart: 8,
|
Cart: 8,
|
||||||
};
|
};
|
||||||
|
|
||||||
return order[a] - order[b];
|
return order[a.title] - order[b.title];
|
||||||
});
|
});
|
||||||
|
|
||||||
for (let i = 0; i < mainTitle.length; i++) {
|
|
||||||
menuItems[i].title = mainTitle[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let j = 0; j < keys.length; j++) {
|
for (let j = 0; j < keys.length; j++) {
|
||||||
const currentKey = keys[j];
|
const currentKey = keys[j];
|
||||||
const subTitle = getMenuData(currentKey);
|
const subData = getMenuData(currentKey);
|
||||||
|
|
||||||
if (subTitle && subTitle.length > 0) {
|
if (subData && subData.length > 0) {
|
||||||
for (let i = 0; i < mainTitle.length; i++) {
|
for (let i = 0; i < mainTitle.length; i++) {
|
||||||
if (mainTitle[i] === currentKey) {
|
menuItems[i].title = mainTitle[i].title;
|
||||||
menuItems[i].children = subTitle.map((title) => ({
|
if (mainTitle[i].title === currentKey) {
|
||||||
title,
|
menuItems[i].children = subData.map((subItem) => ({
|
||||||
|
id: subItem.id,
|
||||||
|
title: subItem.title,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -247,6 +234,7 @@ export default function TabLayout({ topPanelName, onTabActivated }) {
|
|||||||
const tabmenu = new TabMenuItem(
|
const tabmenu = new TabMenuItem(
|
||||||
menuItems[i].icons,
|
menuItems[i].icons,
|
||||||
menuItems[i].title,
|
menuItems[i].title,
|
||||||
|
menuItems[i].id,
|
||||||
menuItems[i].target,
|
menuItems[i].target,
|
||||||
menuItems[i].children
|
menuItems[i].children
|
||||||
);
|
);
|
||||||
@@ -287,7 +275,8 @@ export default function TabLayout({ topPanelName, onTabActivated }) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTIVATED_SUB: {
|
case ACTIVATED_SUB: {
|
||||||
setMainExpanded(false);
|
if (cursorVisible) {
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EXTRA_AREA: {
|
case EXTRA_AREA: {
|
||||||
@@ -303,7 +292,7 @@ export default function TabLayout({ topPanelName, onTabActivated }) {
|
|||||||
return prev;
|
return prev;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
[cursorVisible, deActivateTab]
|
[cursorVisible, deActivateTab, focused]
|
||||||
);
|
);
|
||||||
|
|
||||||
const onTabBlur = useCallback(
|
const onTabBlur = useCallback(
|
||||||
@@ -337,6 +326,14 @@ export default function TabLayout({ topPanelName, onTabActivated }) {
|
|||||||
[cursorVisible]
|
[cursorVisible]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const onFocus = () => {
|
||||||
|
setFocused(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onBlur = () => {
|
||||||
|
setFocused(false);
|
||||||
|
};
|
||||||
|
|
||||||
const handleNavigation = useCallback(
|
const handleNavigation = useCallback(
|
||||||
({ index, target }) => {
|
({ index, target }) => {
|
||||||
setMainSelectedIndex(index);
|
setMainSelectedIndex(index);
|
||||||
@@ -355,10 +352,9 @@ export default function TabLayout({ topPanelName, onTabActivated }) {
|
|||||||
const onClickSubItem = useCallback(
|
const onClickSubItem = useCallback(
|
||||||
({ index, target }) => {
|
({ index, target }) => {
|
||||||
if (target) {
|
if (target) {
|
||||||
dispatch(resetPanels(target));
|
|
||||||
deActivateTab();
|
deActivateTab();
|
||||||
panelSwitching.current = true;
|
panelSwitching.current = true;
|
||||||
// panelSwitchingJob.start(panelSwitching);
|
panelSwitchingJob.start(panelSwitching);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[dispatch, deActivateTab]
|
[dispatch, deActivateTab]
|
||||||
@@ -416,27 +412,24 @@ export default function TabLayout({ topPanelName, onTabActivated }) {
|
|||||||
}, [tabActivated, showTab]);
|
}, [tabActivated, showTab]);
|
||||||
|
|
||||||
useEffect(() => {}, [showSubTab, mainSelectedIndex]);
|
useEffect(() => {}, [showSubTab, mainSelectedIndex]);
|
||||||
|
|
||||||
if (!showTab) {
|
if (!showTab) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classNames(css.tabLayoutWrap, !tabActivated && css.hide)}>
|
<div className={css.tabLayoutWrap}>
|
||||||
{/* collabsed Main */}
|
{/* collabsed Main */}
|
||||||
<Container
|
<Container
|
||||||
className={css.tabWrap}
|
className={classNames(css.tabWrap, css.basicLayout)}
|
||||||
onFocus={onTabHasFocus(COLLABSED_MAIN)}
|
onFocus={onTabHasFocus(COLLABSED_MAIN)}
|
||||||
onMouseOver={onTabHasFocus(COLLABSED_MAIN)}
|
onMouseOver={onTabHasFocus(COLLABSED_MAIN)}
|
||||||
onBlur={onTabBlur(COLLABSED_MAIN)}
|
onBlur={onTabBlur(COLLABSED_MAIN)}
|
||||||
onMouseLeave={onTabBlur(COLLABSED_MAIN)}
|
onMouseLeave={onTabBlur(COLLABSED_MAIN)}
|
||||||
>
|
>
|
||||||
<img className={css.logo} src={shopTimeIcon} alt="" />
|
<img src={shopTimeIcon} alt="" />
|
||||||
{tabs.map((item, index) => (
|
{tabs.map((item, index) => (
|
||||||
<TabItem
|
<TabItem
|
||||||
key={"tabitem" + index}
|
key={"tabitem" + index}
|
||||||
expanded={false}
|
expanded={false}
|
||||||
selected={mainSelectedIndex === index}
|
|
||||||
index={index}
|
index={index}
|
||||||
onClick={handleNavigation}
|
onClick={handleNavigation}
|
||||||
icons={item.icons}
|
icons={item.icons}
|
||||||
@@ -455,29 +448,35 @@ export default function TabLayout({ topPanelName, onTabActivated }) {
|
|||||||
>
|
>
|
||||||
{/* expanded Main */}
|
{/* expanded Main */}
|
||||||
<MainContainer
|
<MainContainer
|
||||||
className={classNames(css.tabWrap, mainExpanded && css.expanded)}
|
className={classNames(
|
||||||
|
css.tabWrap,
|
||||||
|
mainExpanded && css.expanded,
|
||||||
|
css.basicLayout
|
||||||
|
)}
|
||||||
onFocus={onTabHasFocus(ACTIVATED_MAIN)}
|
onFocus={onTabHasFocus(ACTIVATED_MAIN)}
|
||||||
onMouseOver={onTabHasFocus(COLLABSED_MAIN)}
|
onMouseOver={onTabHasFocus(COLLABSED_MAIN)}
|
||||||
onBlur={onTabBlur(ACTIVATED_MAIN)}
|
onBlur={onTabBlur(ACTIVATED_MAIN)}
|
||||||
onMouseLeave={onTabBlur(ACTIVATED_MAIN)}
|
onMouseLeave={onTabBlur(ACTIVATED_MAIN)}
|
||||||
>
|
>
|
||||||
<h1 className={classNames(css.logo, mainExpanded && css.expanded)}>
|
<img src={mainExpanded ? shoptimeFullIcon : shopTimeIcon} alt="" />
|
||||||
<img
|
|
||||||
src={mainExpanded ? shoptimeFullIcon : shopTimeIcon}
|
|
||||||
alt=""
|
|
||||||
/>
|
|
||||||
</h1>
|
|
||||||
|
|
||||||
{tabActivated &&
|
{tabActivated &&
|
||||||
tabs.map((item, index) => (
|
tabs.map((item, index) => (
|
||||||
<TabItem
|
<TabItem
|
||||||
{...item}
|
{...item}
|
||||||
|
onFocus={onFocus}
|
||||||
|
onBlur={onBlur}
|
||||||
key={"tabitemExpanded" + index}
|
key={"tabitemExpanded" + index}
|
||||||
onClick={handleNavigation}
|
onClick={handleNavigation}
|
||||||
deActivateTab={deActivateTab}
|
deActivateTab={deActivateTab}
|
||||||
icons={item.icons}
|
icons={item.icons}
|
||||||
expanded={mainExpanded}
|
expanded={mainExpanded}
|
||||||
selected={mainSelectedIndex === index}
|
selected={
|
||||||
|
(panels.length === 0 && index === 0) ||
|
||||||
|
(Array.isArray(item.target) &&
|
||||||
|
item.target[0]?.name &&
|
||||||
|
panels[0]?.name === item.target[0]?.name)
|
||||||
|
}
|
||||||
title={item.title}
|
title={item.title}
|
||||||
index={index}
|
index={index}
|
||||||
/>
|
/>
|
||||||
@@ -498,7 +497,7 @@ export default function TabLayout({ topPanelName, onTabActivated }) {
|
|||||||
onMouseLeave={onTabBlur(ACTIVATED_SUB)}
|
onMouseLeave={onTabBlur(ACTIVATED_SUB)}
|
||||||
>
|
>
|
||||||
{showSubTab &&
|
{showSubTab &&
|
||||||
tabs[mainSelectedIndex].children.map((item, index) => {
|
tabs[mainSelectedIndex]?.children.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
<TabItem
|
<TabItem
|
||||||
key={"tabitemSubmenu" + index}
|
key={"tabitemSubmenu" + index}
|
||||||
@@ -506,9 +505,10 @@ export default function TabLayout({ topPanelName, onTabActivated }) {
|
|||||||
expanded={true}
|
expanded={true}
|
||||||
index={index}
|
index={index}
|
||||||
isSubItem={true}
|
isSubItem={true}
|
||||||
mainExpanded={mainExpanded}
|
showSubTab={showSubTab}
|
||||||
deActivateTab={deActivateTab}
|
deActivateTab={deActivateTab}
|
||||||
title={item.title}
|
title={item.title}
|
||||||
|
lgCatCd={item.id}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
@import "../../style/utils.module.less";
|
||||||
|
@import "../../style/CommonStyle.module.less";
|
||||||
|
|
||||||
.tabLayoutWrap {
|
.tabLayoutWrap {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@@ -5,6 +8,7 @@
|
|||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
&.hide {
|
&.hide {
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
@@ -18,40 +22,55 @@
|
|||||||
left: 0;
|
left: 0;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
|
||||||
|
|
||||||
&.hide {
|
&.hide {
|
||||||
width: auto;
|
width: auto;
|
||||||
z-index: 0;
|
z-index: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.tabWrap {
|
.tabWrap {
|
||||||
width: 120px;
|
width: 120px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
//position:fixed;
|
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
background-color: #222222;
|
background-color: #222222;
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
// padding-top: 104px;
|
|
||||||
// padding-bottom: 104px;
|
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
flex-grow: 0;
|
flex-grow: 0;
|
||||||
transition: width 0.5s ease;
|
transition: width 0.5s ease;
|
||||||
|
|
||||||
|
> img {
|
||||||
|
width: 54px;
|
||||||
|
height: 54px;
|
||||||
|
margin: -40px 24px 84px 42px
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
&.expanded {
|
&.expanded {
|
||||||
width: 402px;
|
width: 402px;
|
||||||
|
|
||||||
|
> img {
|
||||||
|
width: 234px;
|
||||||
|
height: 54px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
&.secondDepthLayout {
|
&.secondDepthLayout {
|
||||||
width: 386px;
|
width: 386px;
|
||||||
height: calc(100%);
|
height: calc(100%);
|
||||||
opacity: 0.95;
|
opacity: 0.95;
|
||||||
|
|
||||||
box-shadow: 8px 0 36px rgba(33, 33, 32, 0.08);
|
box-shadow: 8px 0 36px rgba(33, 33, 32, 0.08);
|
||||||
padding-bottom: unset;
|
padding-bottom: unset;
|
||||||
|
padding-top: 71px;
|
||||||
|
z-index: 0;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
left: 402px;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
&.extraArea {
|
&.extraArea {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
@@ -61,25 +80,9 @@
|
|||||||
&.hide {
|
&.hide {
|
||||||
width: 0;
|
width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo {
|
|
||||||
width: 54px;
|
|
||||||
height: 54px;
|
|
||||||
margin: 0 0 84px 42px;
|
|
||||||
transition: width 0.5s ease;
|
|
||||||
overflow: hidden;
|
|
||||||
|
|
||||||
&.expanded {
|
|
||||||
width: 234px;
|
|
||||||
height: 54px;
|
|
||||||
> img {
|
|
||||||
width: 234px;
|
|
||||||
height: 54px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
> img {
|
|
||||||
width: 54px;
|
|
||||||
height: 54px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ export const convertThemeColor = (iconType) => {
|
|||||||
const theme = {
|
const theme = {
|
||||||
light: {
|
light: {
|
||||||
normal: "#353535",
|
normal: "#353535",
|
||||||
expanded: "#FEFEFE",
|
expanded: "#353535",
|
||||||
|
selected: "#FEFEFE",
|
||||||
|
focused: "#FEFEFE",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||