홈 배너

This commit is contained in:
focp212@naver.com
2025-10-01 17:15:57 +09:00
parent 0e89a1277c
commit 35f8f1dbd6
9 changed files with 66 additions and 26 deletions

View File

@@ -4,6 +4,8 @@ import { useStore } from '@/shared/model/store';
import { IMAGE_ROOT } from '@/shared/constants/common';
import { UserFavorite } from '@/entities/user/model/types';
import { useEffect, useState } from 'react';
import { useLocation } from 'react-router';
import { PATHS } from '@/shared/constants/paths';
export const MenuCategory = ({
menuId,
@@ -15,6 +17,7 @@ export const MenuCategory = ({
setChangeMenuId
}: MenuCategoryProps) => {
const { navigate } = useNavigate();
const location = useLocation();
const [favoriteItems, setFavoriteItems] = useState<Array<UserFavorite>>([]);
const [menuIds, setMenuIds] = useState<Array<string | undefined>>([]);
@@ -53,6 +56,9 @@ export const MenuCategory = ({
useStore.getState().UserStore.setUserFavorite(userFavorite);
setChangeMenuId(`${menuId}-${checked}`);
callFavoiteItems();
if(location.pathname === PATHS.home){
}
};
const callFavoiteItems = () => {
@@ -123,7 +129,7 @@ export const MenuCategory = ({
<span>{ menuName }</span>
</div>
<ul className="category-items">
{ getMenuItems() }
{ getMenuItems() }
</ul>
</div>
</>