@@ -9,9 +9,16 @@ import "./../../styles/text.css";
99import "./../../styles/utilities.css" ;
1010
1111/**
12- * @param {object } props
13- * @param {number } props.page - 0: "회원가입 페이지", 1: "구매 페이지 中 구매 조건", 2: "구매 페이지 中 환불 유의사항"
14- * @param {string } props.isPerformSelected - 구매 페이지에서 공연권 선택 여부
12+ * PolicyPopup 컴포넌트 Props 설명
13+ * @param {string } title - 팝업 상단에 표시될 제목
14+ * @param {string } detail - 본문 내용 (줄바꿈은 \n 기준으로 나눔)
15+ * @param {function } setShowPopup - 팝업 표시/숨김을 제어하는 state setter
16+ * @param {number } page - 팝업이 어떤 페이지에서 쓰이는지 구분하기 위한 값
17+ * 0: "회원가입 페이지"
18+ * 1: "구매 페이지 中 구매 조건"
19+ * 2: "구매 페이지 中 환불 유의사항"
20+ * 3: (추가로 정의한 다른 페이지 용도)
21+ * @param {boolean } isPerformSelected - 구매 페이지에서 공연권 선택 여부
1522 */
1623const PolicyPopup = ( {
1724 title,
@@ -23,9 +30,12 @@ const PolicyPopup = ({
2330 const { isTablet, isMobile, isSmallMobile } =
2431 useWindowDimensions ( ) . widthConditions ;
2532
33+ const isFullScreenMobile = isSmallMobile || isMobile ;
34+ // ✅ page 상관 없이 모바일이면 fullscreen
35+
2636 useEffect ( ( ) => {
2737 // ✅ 모바일 + 회원가입 약관 페이지(page 0)일 때만 body 스크롤 막기
28- if ( ! ( page === 0 && isSmallMobile ) ) return ;
38+ if ( ! isFullScreenMobile ) return ;
2939
3040 const prevOverflow = document . body . style . overflow ;
3141 document . body . style . overflow = "hidden" ;
@@ -43,46 +53,37 @@ const PolicyPopup = ({
4353 const getPopupSize = ( page , isPerformSelected ) => {
4454 const width = window . innerWidth ;
4555
56+ if ( isFullScreenMobile ) {
57+ return {
58+ width : "100vw" ,
59+ height : "100vh" ,
60+ top : "0" ,
61+ left : "0" ,
62+ } ;
63+ }
64+
4665 if ( page === 0 ) {
47- if ( isSmallMobile ) {
48- return {
49- width : "100vw" ,
50- height : "100vh" ,
51- top : "0" ,
52- left : "0" ,
53- } ;
54- } else {
55- return {
56- width : "500px" ,
57- height : "735px" ,
58- top : "80px" ,
59- left : "calc(50% - 250px)" ,
60- } ;
61- }
66+ return {
67+ width : "500px" ,
68+ height : "735px" ,
69+ top : "80px" ,
70+ left : "calc(50% - 250px)" ,
71+ } ;
6272 }
6373
6474 if ( page === 1 ) {
6575 let size ;
66- // 공연권 선택 X (= 구매자 정보 입력 란 X)일 경우
6776 if ( ! isPerformSelected ) {
68- if ( ! ( isTablet || isMobile || isSmallMobile ) ) {
77+ if ( ! isTablet ) {
6978 size = { width : "414px" , height : "369px" } ;
70- } else if ( isTablet ) {
71- size = { width : "100%" , height : "214px" } ;
72- } else if ( isMobile ) {
73- size = { width : "100%" , height : "392px" } ;
7479 } else {
75- size = { width : "100%" , height : "540px " } ;
80+ size = { width : "100%" , height : "214px " } ;
7681 }
7782 } else {
78- if ( ! ( isTablet || isMobile || isSmallMobile ) ) {
83+ if ( ! isTablet ) {
7984 size = { width : "414px" , height : "468px" } ;
80- } else if ( isTablet ) {
81- size = { width : "100%" , height : "319px" } ;
82- } else if ( isMobile ) {
83- size = { width : "100%" , height : "468px" } ;
8485 } else {
85- size = { width : "100%" , height : "540px " } ;
86+ size = { width : "100%" , height : "319px " } ;
8687 }
8788 }
8889 return { ...size , top : "0" , left : "0" } ;
@@ -140,7 +141,7 @@ const PolicyPopup = ({
140141 const width = window . innerWidth ;
141142
142143 if ( page === 0 ) {
143- if ( isSmallMobile ) {
144+ if ( isFullScreenMobile ) {
144145 return { width : "100%" , height : "calc(100% - 49px)" } ;
145146 }
146147 return { width : "447.137px" , height : "642px" } ;
@@ -197,22 +198,27 @@ const PolicyPopup = ({
197198 return null ;
198199 } ;
199200
200- const isFullScreenMobile = page === 0 && isSmallMobile ;
201-
202201 return (
203- < div className = "popup-overlay" >
202+ < div
203+ className = { `popup-overlay ${
204+ isFullScreenMobile ? "popup-overlay-fullscreen" : ""
205+ } `}
206+ >
204207 < Draggable
205208 handle = ".popup"
206209 disabled = { isFullScreenMobile }
210+ cancel = "#close-btn"
207211 // translate 값
208212 positionOffset = {
209- page === 1 || page === 2
210- ? { x : 0 , y : "calc(-100% - 10px)" }
213+ isFullScreenMobile
214+ ? { x : 0 , y : 0 } // ✅ 풀스크린일 때는 절대 안 밀어내기
215+ : page === 1 || page === 2
216+ ? { x : 0 , y : "calc(-100% - 10px)" } // ✅ 데스크톱에서만 위로 띄우는 용도
211217 : { x : 0 , y : 0 }
212218 }
213219 >
214220 < div
215- className = { `popup ${ isFullScreenMobile ? "popup-fullscreen" : "" } ` }
221+ className = { `popup ${ isFullScreenMobile ? "popup-fullscreen " : "" } ` }
216222 style = { getPopupSize ( page , isPerformSelected ) }
217223 >
218224 < div className = "j-content-between" >
@@ -225,6 +231,7 @@ const PolicyPopup = ({
225231 src = { CloseBtn }
226232 alt = "close"
227233 onClick = { ( ) => {
234+ console . log ( "close" ) ;
228235 setShowPopup ( false ) ;
229236 } }
230237 > </ img >
0 commit comments