홈 배너

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

@@ -5,6 +5,7 @@ import 'swiper/css';
import { IMAGE_ROOT } from '@/shared/constants/common';
import { UserFavorite } from '@/entities/user/model/types';
import { useStore } from '@/shared/model/store';
import { useLocation } from 'react-router';
/*
const items: Array<UserFavorite> = [
@@ -31,7 +32,7 @@ export const FavoriteWrapper = ({
setMenuOn
}: FavoriteWrapperProps) => {
const { navigate } = useNavigate();
const [favoriteItems, setFavoriteItems] = useState<Array<UserFavorite>>([]);
const itemAdd: UserFavorite = {
@@ -40,7 +41,7 @@ export const FavoriteWrapper = ({
};
const onClickToFavoriteEdit = () => {
if(usingType === 'menu' && setEditMode){
if(setEditMode){
setEditMode(true);
}
};
@@ -51,7 +52,6 @@ export const FavoriteWrapper = ({
if(setMenuOn){
setMenuOn(false);
}
}
};
@@ -109,12 +109,13 @@ export const FavoriteWrapper = ({
useEffect(() => {
getFavoriteList();
}, [changeMenuId]);
return (
<>
<Swiper
spaceBetween={ 9 }
slidesPerView={ 4 }
style={{height: '75px'}}
>
{ (favoriteItems.length > 0) && makeFavoriteItems() }
{ makeAddFavoriteItem() }

View File

@@ -0,0 +1,14 @@
import { useSetFavoriteEdit, useSetMenuOn } from '@/widgets/sub-layout/use-sub-layout';
export interface HiddenPageProps {
}
export const HiddenPage = ({
}: HiddenPageProps) => {
useSetMenuOn(true);
useSetFavoriteEdit(true);
return (
<></>
);
};

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>
</>