Skip to content

Commit b48ced4

Browse files
authored
Merge pull request #168 from Podo-Store/fix/upload-script
fix: 작품 등록하기 레이아웃 수정
2 parents 8fcc7c0 + 3f2fad2 commit b48ced4

File tree

5 files changed

+155
-56
lines changed

5 files changed

+155
-56
lines changed

src/App.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,11 @@ textarea {
2525
/* 전역 설정 */
2626
font-family: "pretendard", "Apple SD Gothic Neo", Sans-serif !important;
2727
}
28+
29+
button {
30+
padding: 0;
31+
32+
cursor: pointer;
33+
border: none;
34+
background-color: transparent;
35+
}
-264 KB
Loading

src/components/popup/InfoPopup.jsx

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ import "./../../styles/text.css";
77
* 사용 시, 부모 요소 및 자매(sibling) 요소에 position: relative;를 설정해야 함.
88
* @param {Object} props - Component properties
99
* @param {function} props.onClose: 팝업을 닫을 때 호출할 함수
10-
* @param props.style - padding, left 사용 권장.
10+
* @param {React.CSSProperties} props.style - padding, left 사용 권장.
1111
* @param {string} props.buttonId: 팝업을 띄우는 버튼의 id (e.g. "popup-btn2")
12-
*
13-
* @param {string} message - 팝업 메시지
12+
* @param {React.ReactNode} message - 팝업 메시지 등의 React Node
1413
* @param {string} message2 - 두 번째 팝업 메시지 (존재 시 상단 구분 바 (---) 생성 및 아래에 출력)
1514
* @returns
1615
*/
@@ -41,24 +40,24 @@ const InfoPopup = ({ message, onClose, style, buttonId, message2 }) => {
4140

4241
return (
4342
<div className="info-popup" style={{ ...style }} ref={popupRef}>
44-
{
45-
// \n으로 구분된 문자열을 줄바꿈으로 나누어 출력
46-
message.split("\n").map((line, index) => (
47-
<p key={index} className="p-xs-regular c-black">
48-
{/* PerformanceInfo 한정 사용 요소 */}
49-
{line.includes("변경이 어려우니") ? (
50-
<span>
51-
{line.split("변경이 어려우니")[0]}
52-
<span style={{ textDecoration: "underline" }}>변경이 어려우니</span>
53-
{line.split("변경이 어려우니")[1]}
54-
</span>
55-
) : (
56-
line
57-
)}
58-
<br />
59-
</p>
60-
))
61-
}
43+
{typeof message !== "string"
44+
? message
45+
: // \n으로 구분된 문자열을 줄바꿈으로 나누어 출력
46+
message.split("\n").map((line, index) => (
47+
<p key={index} className="p-xs-regular c-black">
48+
{/* PerformanceInfo 한정 사용 요소 */}
49+
{line.includes("변경이 어려우니") ? (
50+
<span>
51+
{line.split("변경이 어려우니")[0]}
52+
<span style={{ textDecoration: "underline" }}>변경이 어려우니</span>
53+
{line.split("변경이 어려우니")[1]}
54+
</span>
55+
) : (
56+
line
57+
)}
58+
<br />
59+
</p>
60+
))}
6261
{message2 ? (
6362
<>
6463
<hr />

src/pages/work/PostWork.jsx

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { Dialog, DialogContent } from "@mui/material";
22
import axios from "axios";
33
import Cookies from "js-cookie";
4-
import React, { useEffect, useRef, useState } from "react";
4+
import React, { useRef, useState } from "react";
55
import { useNavigate } from "react-router-dom";
66

77
import FileInputBox from "../../components/file/FileInputBox";
88
import AnimatedCheckedSvg from "@/components/loading/AnimatedCheckedSvg";
99
import PartialLoading from "@/components/loading/PartialLoading";
10+
import InfoPopup from "@/components/popup/InfoPopup";
1011

1112
import { SERVER_URL } from "../../constants/ServerURL";
1213

@@ -31,20 +32,6 @@ const PostWork = () => {
3132
const [showPopup, setShowPopup] = useState(false);
3233
const popupRef = useRef(null);
3334

34-
useEffect(() => {
35-
const handleClickOutside = (event) => {
36-
// event.target이 popupRef.current의 child가 아닐 때
37-
if (popupRef.current && !popupRef.current.contains(event.target)) {
38-
setShowPopup(false);
39-
}
40-
};
41-
document.addEventListener("mousedown", handleClickOutside);
42-
43-
return () => {
44-
document.removeEventListener("mousedown", handleClickOutside);
45-
};
46-
}, []);
47-
4835
const navigate = useNavigate();
4936

5037
const onClickUpload = async () => {
@@ -133,9 +120,9 @@ const PostWork = () => {
133120
</div>
134121
</div>
135122

136-
<div class="arrow-box">
123+
<div className="arrow-box">
137124
<img src={doubleRiteIcon} alt="doubleRite" style={{ width: "30px" }} />
138-
<div class="divider"></div>
125+
<div className="divider"></div>
139126
</div>
140127

141128
{/* 포도송이 */}
@@ -164,10 +151,39 @@ const PostWork = () => {
164151
</div>
165152
</div>
166153
</div>
154+
167155
<div>
168-
<div className="upload-title">
156+
<div className="upload-title items-center gap-[8px] relative">
169157
<h6>작품 등록 신청</h6>
170158
{/* 팝업 메뉴 */}
159+
<button
160+
id="info-btn"
161+
className="w-fit h-[20px] box-border"
162+
onClick={() => setShowPopup(!showPopup)}
163+
>
164+
<img src={infoBtn} alt="infoBtn" />
165+
</button>
166+
{showPopup && (
167+
<div ref={popupRef}>
168+
<InfoPopup
169+
message={
170+
<img
171+
className="popup-process"
172+
src={postingProcess2}
173+
alt="작품 등록 도식화"
174+
/>
175+
}
176+
onClose={() => setShowPopup(!showPopup)}
177+
style={{
178+
top: "unset",
179+
bottom: "0",
180+
padding: "11px",
181+
transform: "translate(calc(113.75px + 8px + 20px + 5px), 0)",
182+
}}
183+
buttonId="info-btn"
184+
/>
185+
</div>
186+
)}
171187
</div>
172188

173189
<FileInputBox
@@ -186,7 +202,9 @@ const PostWork = () => {
186202
</div>
187203
</div>
188204
</div>
189-
<img className="right-side" src={postingProcess} alt="작품 등록 도식화"></img>
205+
<div className="right-side">
206+
<img src={postingProcess} alt="작품 등록 도식화"></img>
207+
</div>
190208
</div>
191209
</div>
192210
);

src/pages/work/PostWork.scss

Lines changed: 90 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
33

44
.post-work {
55
width: 100vw;
6-
height: 100vh;
6+
// 이미지를 absolute로 설정하여 높이 직접 입력 필요
7+
// height: fit-content;
8+
@include r.media-desktop {
9+
height: calc(58px + 938px);
10+
}
11+
@include r.media-laptop {
12+
height: calc(75px + 869px);
13+
}
714
}
815

916
.post-work .post-work-wrap {
@@ -20,7 +27,10 @@
2027
}
2128

2229
.post-work .left-side {
30+
flex: 1;
2331
@include r.media-laptop {
32+
margin-left: 77px;
33+
margin-right: 55px;
2434
}
2535
@include r.media-tablet {
2636
flex: 1;
@@ -32,13 +42,27 @@
3242
}
3343

3444
.post-work .right-side {
35-
width: 59.804%;
36-
height: 100vh;
45+
flex: 1;
46+
47+
position: relative;
3748
@include r.media-tablet {
3849
display: none;
3950
}
4051
}
4152

53+
.post-work .right-side img {
54+
position: absolute;
55+
top: 58px;
56+
right: 0;
57+
58+
@include r.media-laptop {
59+
top: 75px;
60+
61+
width: 517px;
62+
height: 869px;
63+
}
64+
}
65+
4266
.post-work .inside-field {
4367
display: flex;
4468
flex-direction: column;
@@ -50,7 +74,13 @@
5074
}
5175

5276
.post-work .inside-field-title {
53-
margin-top: 16.111vh;
77+
margin-top: 174px;
78+
@include r.media-laptop {
79+
margin-top: 90px;
80+
}
81+
@include r.media-mobile {
82+
margin-top: 50px;
83+
}
5484
}
5585

5686
.post-work .title h1 {
@@ -64,14 +94,18 @@
6494
line-height: 2.75rem; /* 122.222% */
6595
}
6696

67-
.stage-info-container {
97+
.post-work .stage-info-container {
6898
width: 100%;
6999
height: auto;
70100

71101
display: flex;
72102
flex-direction: column;
73-
margin-top: 8.05556vh;
74-
margin-bottom: 8.42592593vh;
103+
margin-top: 87px;
104+
margin-bottom: 66px;
105+
106+
@include r.media-mobile {
107+
margin-top: 58px;
108+
}
75109

76110
.title {
77111
color: #000;
@@ -86,9 +120,18 @@
86120

87121
.contants {
88122
display: grid;
89-
margin-top: 4.907vh;
90123
grid-template-columns: 37fr 5fr 30fr 5fr 25fr;
124+
125+
margin-top: 4.907vh;
126+
91127
height: 100%;
128+
129+
@include r.media-mobile {
130+
grid-template-columns: 120px 30px 104px 30px 110px;
131+
}
132+
p {
133+
white-space: nowrap;
134+
}
92135
}
93136

94137
.step {
@@ -104,6 +147,8 @@
104147
justify-content: center;
105148
margin-bottom: 1.9444vh;
106149

150+
box-sizing: border-box;
151+
107152
p {
108153
color: #000;
109154

@@ -116,11 +161,12 @@
116161
}
117162
}
118163
.info {
119-
color: var(--ect-black, #000);
120-
text-align: center;
121164
display: flex;
122165
flex-direction: column;
123166
gap: 2px;
167+
168+
color: var(--ect-black, #000);
169+
124170
font-family: Pretendard;
125171
font-size: 0.875rem;
126172
font-style: normal;
@@ -139,24 +185,38 @@
139185
}
140186
}
141187

142-
.arrow-box {
188+
/*
189+
* 두 번째 .step .icon: 왼쪽에 있는 첫 번째 .step 하단의 text 길이에 의해 중앙 왜곡
190+
* -> 대략 10px, ∴ 대략 절반 정도 좌측으로 translate.
191+
*/
192+
.post-work .contants .step:nth-child(3) .icon {
193+
transform: translateX(-5px);
194+
}
195+
196+
.post-work .arrow-box {
143197
position: relative;
144198

199+
@include r.media-mobile {
200+
height: fit-content;
201+
}
145202
img {
146203
margin-top: 50%;
147204
}
148205
}
149206

150-
.divider {
207+
.post-work .divider {
151208
position: absolute;
152209
top: 60%;
153210
left: 50%;
154211
transform: translateX(-50%);
155212
height: 6.9444vh;
156213
border-left: 1px dashed #9e9e9e;
214+
@include r.media-laptop {
215+
display: none;
216+
}
157217
}
158218

159-
.TBD-info {
219+
.post-work .TBD-info {
160220
width: 200%;
161221
color: var(--ect-black, #000);
162222

@@ -166,13 +226,20 @@
166226
font-style: normal;
167227
font-weight: 500;
168228
line-height: 20px; /* 142.857% */
229+
text-align: center;
230+
@include r.media-mobile {
231+
width: fit-content;
232+
233+
transform: translateX(50%);
234+
}
169235
}
170236

171237
.post-work .upload-title {
172238
display: flex;
173239
align-items: center;
174240

175-
margin-bottom: 1.4815vh;
241+
// FileInputBox에 상단 margin 존재 - 제거 예정, 0.63rem만큼의 차 필요
242+
margin-bottom: calc(16px - 0.63rem);
176243
}
177244

178245
.post-work .upload-title h6 {
@@ -196,7 +263,7 @@
196263
}
197264
}
198265

199-
.post-work .upload-title .image-popup {
266+
.post-work .upload-title .post-work .upload-title .image-popup {
200267
position: absolute;
201268
top: 20px;
202269
left: 25px;
@@ -230,7 +297,7 @@
230297
@include m.purple-btn;
231298

232299
width: 100%;
233-
height: 4.444vh;
300+
height: 48px;
234301

235302
margin-top: 2.593vh;
236303

@@ -255,3 +322,10 @@
255322
background: var(--Sub-2, #dadada);
256323
cursor: default;
257324
}
325+
326+
.post-work .popup-process {
327+
@include r.media-mobile {
328+
width: 242px;
329+
height: 402px;
330+
}
331+
}

0 commit comments

Comments
 (0)