홈화면 배너 처리

This commit is contained in:
focp212@naver.com
2025-09-22 16:33:18 +09:00
parent 0480108942
commit 55424b11fb
13 changed files with 87 additions and 34 deletions

View File

@@ -8,8 +8,12 @@ export const DEFAULT_PAGE_PARAM = {
};
export const FilterMotionVariants = {
hidden: {x: '100%'},
visible: {x: '0%'},
hidden: {
x: '100%'
},
visible: {
x: '0%'
},
};
export const FilterMotionDuration = {
duration: 0.3
@@ -20,8 +24,12 @@ export const FilterMotionStyle = {
};
export const BottomSheetMotionVaiants = {
hidden: { y: '100%' },
visible: { y: '0%' },
hidden: {
y: '100%'
},
visible: {
y: '0%'
},
};
export const BottomSheetMotionDuration = {
duration: 0.3

View File

@@ -0,0 +1,26 @@
import { lens } from '@dhmk/zustand-lens';
import { SetStateAction } from 'react';
import { BannerInfo } from './types';
export interface BannerInfoState {
bannerInfo: BannerInfo;
setBannerInfo: (update: SetStateAction<Partial<BannerInfo>>) => void;
};
const initialState = {
bannerInfo: {} as BannerInfo,
} as BannerInfoState;
export const createBannerInfoStore = lens<BannerInfoState>((set, get) => ({
...initialState,
setBannerInfo: (update) => {
set((state: BannerInfoState) => {
const newBannerInfo = typeof update === 'function' ? update(state.bannerInfo) : update;
return {
...state,
bannerInfo: { ...state.bannerInfo, ...newBannerInfo },
};
});
},
}));

View File

@@ -190,4 +190,7 @@ export interface EmptyTokenAddSendCodeResponse {
export interface SectionArrowProps {
isOpen?: boolean;
};
};
export interface BannerInfo {
HomneBottomBanner: boolean;
};

View File

@@ -2,6 +2,7 @@ import { IMAGE_ROOT } from '@/shared/constants/common';
import { AuthRegisterProps } from '../model/types';
import { motion } from 'framer-motion';
import { useAppBridge } from '@/hooks/useAppBridge';
import { BottomSheetMotionDuration, BottomSheetMotionVaiants } from '@/entities/common/model/constant';
export const AuthRegister = ({
setAuthRegisterOn,
@@ -18,11 +19,6 @@ export const AuthRegister = ({
setAuthRegisterOn(false);
};
const variants = {
hidden: { y: '100%' },
visible: { y: '0%' },
};
return (
<>
{ (authRegisterOn) &&
@@ -32,8 +28,8 @@ export const AuthRegister = ({
className="bottomsheet"
initial="hidden"
animate={ (authRegisterOn)? 'visible': 'hidden' }
variants={ variants }
transition={{ duration: 0.5 }}
variants={ BottomSheetMotionVaiants }
transition={ BottomSheetMotionDuration }
>
<div className="bottomsheet-header">
<div className="bottomsheet-title">

View File

@@ -1,20 +1,27 @@
import moment from 'moment';
import { motion } from 'framer-motion';
import { IMAGE_ROOT } from '@/shared/constants/common';
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
import { StorageKeys } from '@/shared/constants/local-storage';
import { setLocalStorage } from '@/shared/lib/web-view-bridge';
import { HomeBottomBannerProps } from '../model/types';
import { motion } from 'framer-motion';
import { useStore } from '@/shared/model/store';
import { BottomSheetMotionDuration, BottomSheetMotionVaiants } from '@/entities/common/model/constant';
import { useEffect, useState } from 'react';
export const HomeBottomBanner = ({
setBottomBannerOn,
bottomBannerOn
}: HomeBottomBannerProps) => {
const { navigate } = useNavigate();
const [isFirstOpen, setIsFirstOpen] = useState<boolean>(false);
const onClickToClose = () => {
// close
setBottomBannerOn(false);
useStore.getState().BannerStore.setBannerInfo({
HomneBottomBanner: true
});
};
const onClickToCloseDay = () => {
// 오늘 날짜 기록
@@ -23,22 +30,28 @@ export const HomeBottomBanner = ({
onClickToClose();
};
const variants = {
hidden: { y: '100%' },
visible: { y: '0%' },
};
useEffect(() => {
let bannerInfo = useStore.getState().BannerStore.bannerInfo;
if(!!bannerInfo.HomneBottomBanner){
setIsFirstOpen(false);
}
else{
setIsFirstOpen(true);
}
}, [bottomBannerOn]);
return (
<>
{bottomBannerOn &&
{bottomBannerOn && isFirstOpen &&
<div className="bg-dim"></div>
}
<motion.div
className="bottomsheet banner"
initial="hidden"
animate={ (bottomBannerOn)? 'visible': 'hidden' }
variants={ variants }
transition={{ duration: 0.5 }}
animate={ (bottomBannerOn && isFirstOpen)? 'visible': 'hidden' }
variants={ BottomSheetMotionVaiants }
transition={ BottomSheetMotionDuration }
>
<div className="bottomsheet-content">
<img

View File

@@ -1,26 +1,26 @@
import { lens } from '@dhmk/zustand-lens';
import { SetStateAction } from 'react';
import { UserInfo } from '@/entities/user/model/types';
import { StorageKeys } from '~/shared/constants/local-storage';
import { UserInfo } from './types';
import { StorageKeys } from '@/shared/constants/local-storage';
export interface UserInfoState {
UserInfo: UserInfo;
userInfo: UserInfo;
setUserInfo: (update: SetStateAction<Partial<UserInfo>>) => void;
resetUserInfo: () => void;
}
};
const initialState = {
UserInfo: {} as UserInfo,
userInfo: {} as UserInfo,
} as UserInfoState;
export const createUserInfoStore = lens<UserInfoState>((set, get) => ({
...initialState,
setUserInfo: (update) => {
set((state: UserInfoState) => {
const newUserInfo = typeof update === 'function' ? update(state.UserInfo) : update;
const newUserInfo = typeof update === 'function' ? update(state.userInfo) : update;
return {
...state,
UserInfo: { ...state.UserInfo, ...newUserInfo },
userInfo: { ...state.userInfo, ...newUserInfo },
};
});
},

View File

@@ -21,7 +21,7 @@ export interface LoginResponse {
available2FAMethod?: Array<string>;
requires2FA?: boolean;
};
export interface UserInfo extends LoginResponse{
export interface UserInfo extends LoginResponse {
}
export interface UserParams {