작업중

This commit is contained in:
focp212@naver.com
2025-09-29 16:59:26 +09:00
parent 74ab29f80a
commit 0a747469a6
18 changed files with 313 additions and 111 deletions

View File

@@ -3,8 +3,10 @@ export interface MenuCategoryItem {
path: string;
};
export interface MenuCategoryProps {
key: string;
category: string;
categoryIcon?: string;
items: Array<MenuCategoryItem>;
setMenuOn: (menuOn: boolean) => void;
favoriteEdit?: boolean;
};

View File

@@ -1,35 +1,70 @@
import { PATHS } from '@/shared/constants/paths';
import { IMAGE_ROOT } from '@/shared/constants/common';
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
import { MenuCategoryProps } from '../model/types';
import { useStore } from '@/shared/model/store';
import { IMAGE_ROOT } from '@/shared/constants/common';
export const MenuCategory = ({
category,
categoryIcon,
items,
setMenuOn
setMenuOn,
favoriteEdit
}: MenuCategoryProps) => {
const { navigate } = useNavigate();
const onClickToNavigate = (path?: string) => {
if(!!path){
if(!!path && !favoriteEdit){
setMenuOn(false);
navigate(path);
}
};
const favoriteSetting = (
checked: boolean,
title?: string,
path?: string
) => {
useStore.getState().UserStore.setUserFavorite([{
title: title,
img: IMAGE_ROOT + '/ico_menu_01.svg',
path: path,
}]);
};
const getMenuItems = () => {
let rs = [];
for(let i=0;i<items.length;i++){
let title = items[i]?.title;
let path = items[i]?.path;
let key = 'menu-item-key-'+i;
rs.push(
<li
key={ key }
onClick={ () => onClickToNavigate(path) }
>{ title }</li>
);
if(!!favoriteEdit){
rs.push(
<li
key={ `menu-item-key-${category}-${i}` }
onClick={ () => onClickToNavigate(items[i]?.path) }
>
<span>{ items[i]?.title }</span>
<div className="check_box_scrap">
<input
id={ `menu-item-checkbox-${category}-${i}` }
className="checkbox"
type="checkbox"
onChange={ (e) => favoriteSetting(e.target.checked, items[i]?.title, items[i]?.path) }
/>
<label
className="gtr"
htmlFor={ `menu-item-checkbox-${category}-${i}` }
></label>
</div>
</li>
);
}
else{
rs.push(
<li
key={ `menu-item-key-${i}` }
onClick={ () => onClickToNavigate(items[i]?.path) }
>{ items[i]?.title }</li>
);
}
}
return rs;
};