@@ -20,16 +20,17 @@ const PolicyPopup = ({
2020 page = 0 ,
2121 isPerformSelected = true ,
2222} ) => {
23- const { isSmallMobile } = useWindowDimensions ( ) . widthConditions ;
24-
23+ const { isTablet, isMobile, isSmallMobile } =
24+ useWindowDimensions ( ) . widthConditions ;
25+
26+ /*
27+ * 팝업 크기 수정 가이드
28+ * - 추후 크기 관련 수정이 필요할 경우, page === 1 || page === 2일 때를 참고하여 refactor하는 것을 권장.
29+ * - 만약 표시되는 위치를 바꾸기 위해 translate 요소를 조정할 경우, return 문의 <Draggable> 요소의 props를 수정할 것.
30+ */
2531 const getPopupSize = ( page , isPerformSelected ) => {
2632 const width = window . innerWidth ;
2733
28- // 공연권 미선택 && 구매 관련 페이지
29- if ( ! isPerformSelected && ( page === 1 || page === 2 ) ) {
30- return { width : "413px" , height : "273px" , top : "0" , left : "0" } ;
31- }
32-
3334 if ( page === 0 ) {
3435 if ( ! isSmallMobile ) {
3536 return {
@@ -49,19 +50,44 @@ const PolicyPopup = ({
4950 }
5051
5152 if ( page === 1 ) {
52- if ( ! isSmallMobile ) {
53- return { width : "413px" , height : "465px" , top : "0" , left : "0" } ;
53+ let size ;
54+ // 공연권 선택 X (= 구매자 정보 입력 란 X)일 경우
55+ if ( ! isPerformSelected ) {
56+ if ( ! ( isTablet || isMobile || isSmallMobile ) ) {
57+ size = { width : "414px" , height : "369px" } ;
58+ } else if ( isTablet ) {
59+ size = { width : "100%" , height : "214px" } ;
60+ } else if ( isMobile ) {
61+ size = { width : "100%" , height : "392px" } ;
62+ } else {
63+ size = { width : "100%" , height : "540px" } ;
64+ }
5465 } else {
55- return { width : "280px" , height : "540px" , top : "0" , left : "0" } ;
66+ if ( ! ( isTablet || isMobile || isSmallMobile ) ) {
67+ size = { width : "414px" , height : "468px" } ;
68+ } else if ( isTablet ) {
69+ size = { width : "100%" , height : "319px" } ;
70+ } else if ( isMobile ) {
71+ size = { width : "100%" , height : "468px" } ;
72+ } else {
73+ size = { width : "100%" , height : "540px" } ;
74+ }
5675 }
76+ return { ...size , top : "0" , left : "0" } ;
5777 }
5878
5979 if ( page === 2 ) {
60- if ( ! isSmallMobile ) {
61- return { width : "413px" , height : "288px" , top : "0" , left : "0" } ;
80+ let size ;
81+ if ( ! ( isTablet || isMobile || isSmallMobile ) ) {
82+ size = { width : "414px" , height : "288px" } ;
83+ } else if ( isTablet ) {
84+ size = { width : "100%" , height : "229px" } ;
85+ } else if ( isMobile ) {
86+ size = { width : "100%" , height : "288px" } ;
6287 } else {
63- return { width : "280px " , height : "384px" , top : "0" , left : "0 " } ;
88+ size = { width : "100% " , height : "384px" } ;
6489 }
90+ return { ...size , top : "0" , left : "0" } ;
6591 }
6692
6793 if ( page === 3 ) {
@@ -101,11 +127,6 @@ const PolicyPopup = ({
101127 const getPopupContentsSize = ( page , isPerformSelected ) => {
102128 const width = window . innerWidth ;
103129
104- // 공연권 미선택 && 구매 관련 페이지
105- if ( ! isPerformSelected && ( page === 1 || page === 2 ) ) {
106- return { width : "369px" , height : "179px" } ;
107- }
108-
109130 if ( page === 0 ) {
110131 if ( ! isSmallMobile ) {
111132 return { width : "447.137px" , height : "642px" } ;
@@ -114,20 +135,8 @@ const PolicyPopup = ({
114135 }
115136 }
116137
117- if ( page === 1 ) {
118- if ( ! isSmallMobile ) {
119- return { width : "369px" , height : "375px" } ;
120- } else {
121- return { width : "236px" , height : "447px" } ;
122- }
123- }
124-
125- if ( page === 2 ) {
126- if ( ! isSmallMobile ) {
127- return { width : "369px" , height : "195px" } ;
128- } else {
129- return { width : "236px" , height : "291px" } ;
130- }
138+ if ( page === 1 || page === 2 ) {
139+ return { width : "100%" , height : "calc(100% - 49px)" } ;
131140 }
132141
133142 if ( page === 3 ) {
@@ -159,11 +168,6 @@ const PolicyPopup = ({
159168 const getPopupContentsMaxSize = ( page , isPerformSelected ) => {
160169 const width = window . innerWidth ;
161170
162- // 공연권 미선택 && 구매 관련 페이지
163- if ( ! isPerformSelected && ( page === 1 || page === 2 ) ) {
164- return { maxHeight : "159px" } ;
165- }
166-
167171 if ( page === 0 ) {
168172 if ( ! isSmallMobile ) {
169173 return { maxHeight : "620px" } ;
@@ -172,20 +176,8 @@ const PolicyPopup = ({
172176 }
173177 }
174178
175- if ( page === 1 ) {
176- if ( ! isSmallMobile ) {
177- return { maxHeight : "350px" } ;
178- } else {
179- return { maxHeight : "419px" } ;
180- }
181- }
182-
183- if ( page === 2 ) {
184- if ( ! isSmallMobile ) {
185- return { maxHeight : "159px" } ;
186- } else {
187- return { maxHeight : "263px" } ;
188- }
179+ if ( page === 1 || page === 2 ) {
180+ return { maxHeight : "100%" } ;
189181 }
190182
191183 if ( page === 3 ) {
@@ -196,7 +188,15 @@ const PolicyPopup = ({
196188 } ;
197189
198190 return (
199- < Draggable handle = ".popup" >
191+ < Draggable
192+ handle = ".popup"
193+ // translate 값
194+ positionOffset = {
195+ page === 1 || page === 2
196+ ? { x : 0 , y : "calc(-100% - 10px)" }
197+ : { x : 0 , y : 0 }
198+ }
199+ >
200200 < div className = "popup" style = { getPopupSize ( page , isPerformSelected ) } >
201201 < div className = "j-content-between" >
202202 < div className = "j-content-center a-items-center" id = "title" >
0 commit comments