Skip to content

Commit e7350f0

Browse files
authored
Merge pull request #506 from GTable/feat/bannerImage/quality
fix: 미리보기 모달 깨짐현상 수정
2 parents 457e6f3 + 3cef121 commit e7350f0

File tree

2 files changed

+36
-5
lines changed

2 files changed

+36
-5
lines changed

apps/nowait-admin/src/pages/AdminBooth/components/BoothSection.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ const BoothSection = ({
243243
</div>
244244
</div>
245245

246-
{/* 배너 이미지 */}
247246
{/* 배너 이미지 */}
248247
<div className="flex flex-col mb-[50px] max-w-[614px]">
249248
<label

apps/nowait-admin/src/pages/AdminBooth/components/Modal/PreviewModal.tsx

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from "react";
1+
import React, { useEffect } from "react";
22
import clock from "../../../../assets/preview/clock.svg";
33
import pin from "../../../../assets/preview/map-pin.svg";
44
import right from "../../../../assets/preview/keyboard_arrow_right.svg";
@@ -48,8 +48,40 @@ const PreviewModal: React.FC<PreviewModalProps> = ({
4848
const waitingCount = Number(localStorage.getItem("waitingCount"));
4949
console.log(boothIntro, "게시글");
5050

51+
useEffect(() => {
52+
const body = document.body;
53+
const scrollY =
54+
window.scrollY ||
55+
window.pageYOffset ||
56+
document.documentElement.scrollTop ||
57+
0;
58+
59+
// 스크롤바 사라져서 레이아웃 점프 방지용 padding-right
60+
const scrollbarW = window.innerWidth - document.documentElement.clientWidth;
61+
62+
body.style.position = "fixed";
63+
body.style.top = `-${scrollY}px`;
64+
body.style.left = "0";
65+
body.style.right = "0";
66+
body.style.width = "100%";
67+
body.style.overflow = "hidden";
68+
if (scrollbarW > 0) body.style.paddingRight = `${scrollbarW}px`;
69+
70+
return () => {
71+
// 원복 + 원래 위치로 스크롤 복구
72+
body.style.position = "";
73+
body.style.top = "";
74+
body.style.left = "";
75+
body.style.right = "";
76+
body.style.width = "";
77+
body.style.overflow = "";
78+
body.style.paddingRight = "";
79+
window.scrollTo(0, scrollY);
80+
};
81+
}, []);
82+
5183
return (
52-
<div className="fixed inset-0 bg-black/40 flex items-center justify-center z-50">
84+
<div className="fixed inset-0 bg-black/40 flex items-center justify-center z-50 overscroll-contain">
5385
<div className="flex flex-col items-center bg-white rounded-[20px] w-[372px] h-[706px] p-[30px] ">
5486
<h2 className="text-title-20-bold text-black-85 mb-[10px] text-center">
5587
화면 미리보기
@@ -100,13 +132,13 @@ const PreviewModal: React.FC<PreviewModalProps> = ({
100132
</span>
101133
{/* 게시글 */}
102134
<div
103-
className="h-[98px] mt-[15.43px] mb-[28.5px] text-10-regular"
135+
className="h-[98px] mt-[15.43px] mb-[28.5px] text-10-regular overflow-y-auto"
104136
dangerouslySetInnerHTML={{
105137
__html: DOMPurify.sanitize(boothIntro.replace(/\n/g, "<br />")),
106138
}}
107139
></div>
108140
{/* 공지 알림 */}
109-
<div className="flex items-center justify-between w-full rounded-[6.29px] px-[10px] py-[8.81px] bg-black-10 border-[#ECECEC] border-[0.63px]">
141+
<div className="flex items-center justify-between w-full rounded-[6.29px] px-[10px] py-[8.81px] bg-black-10 border-[#ECECEC] border-[0.63px] ">
110142
<p className="text-notice-medium text-black-70 truncate">
111143
<span className="text-black-50 text-notice mr-[3.78px]">
112144
공지

0 commit comments

Comments
 (0)