가맹점관리
This commit is contained in:
@@ -28,7 +28,7 @@ export const Menu = ({
|
||||
const [changeMenuId, setChangeMenuId] = useState<string | undefined>();
|
||||
|
||||
const buttonRefs = useRef<Array<HTMLDivElement>>([]);
|
||||
const btnRef = useRef<HTMLDivElement>(null);
|
||||
const scrollRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const onClickToNavigate = (path: string) => {
|
||||
onClickToMenuClose();
|
||||
@@ -42,21 +42,6 @@ export const Menu = ({
|
||||
behavior: 'smooth'
|
||||
});
|
||||
*/
|
||||
if(index === 1){
|
||||
/*
|
||||
btnRef.current?.scrollTo({
|
||||
top: 300,
|
||||
behavior: "smooth"
|
||||
});
|
||||
*/
|
||||
btnRef.current?.scrollIntoView({
|
||||
block: 'start',
|
||||
behavior: 'smooth'
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
const onClickToMenuClose = () => {
|
||||
if(editMode){
|
||||
@@ -70,8 +55,7 @@ export const Menu = ({
|
||||
const getMenuCategory = () => {
|
||||
let rs = [];
|
||||
for(let i=0;i<MenuItems.length;i++){
|
||||
if(i===1){
|
||||
rs.push(
|
||||
rs.push(
|
||||
<MenuCategory
|
||||
key={ `menu-category-${i}` }
|
||||
menuId={ MenuItems[i]?.menuId }
|
||||
@@ -81,28 +65,8 @@ export const Menu = ({
|
||||
setMenuOn={ setMenuOn }
|
||||
editMode={ editMode }
|
||||
setChangeMenuId= { setChangeMenuId }
|
||||
buttonRef={ buttonRefs.current[i] }
|
||||
btnRef={ btnRef }
|
||||
/>
|
||||
);
|
||||
}
|
||||
else{
|
||||
rs.push(
|
||||
<MenuCategory
|
||||
key={ `menu-category-${i}` }
|
||||
menuId={ MenuItems[i]?.menuId }
|
||||
menuIcon={ MenuItems[i]?.menuIcon }
|
||||
menuName={ MenuItems[i]?.menuName }
|
||||
subMenu={ MenuItems[i]?.subMenu }
|
||||
setMenuOn={ setMenuOn }
|
||||
editMode={ editMode }
|
||||
setChangeMenuId= { setChangeMenuId }
|
||||
buttonRef={ buttonRefs.current[i] }
|
||||
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
return rs;
|
||||
};
|
||||
@@ -121,12 +85,7 @@ export const Menu = ({
|
||||
|
||||
useEffect(() => {
|
||||
shortBtnsSetting();
|
||||
const handleScroll = (e: Event) => {
|
||||
// console.log(e, window.scrollY);
|
||||
};
|
||||
window.addEventListener('scroll', handleScroll);
|
||||
}, []);
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -194,7 +153,10 @@ export const Menu = ({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="full-menu-list">
|
||||
<div
|
||||
className="full-menu-list"
|
||||
ref={ scrollRef }
|
||||
>
|
||||
{ getMenuCategory() }
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user