Skip to content

Commit a6209e5

Browse files
authored
feat: 결제 페이지 UI 수정사항 반영 (#341)
1 parent 9714d10 commit a6209e5

File tree

7 files changed

+132
-111
lines changed

7 files changed

+132
-111
lines changed

src/components/popup/PolicyPopup.css

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.popup {
2-
padding-top: 1.5rem;
3-
padding-left: 1.5rem;
2+
padding: 22px;
43

54
position: absolute;
65

@@ -27,7 +26,7 @@
2726
}
2827

2928
.popup img#close-btn {
30-
transform: translate(-1rem, -0.7rem);
29+
transform: translate(0, -0.7rem);
3130
}
3231

3332
.popup div#content-wrap {

src/components/popup/PolicyPopup.jsx

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -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">

src/components/purchase/PurchaseCheckBox.jsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const PurchaseCheckBox = ({ setCheckBoxCondition, isPerformSelected }) => {
5353
};
5454

5555
return (
56-
<div className="f-dir-column purchase-checkbox">
56+
<div className="purchase-checkbox flex flex-col relative">
5757
{/* 개별 항목 체크박스 */}
5858
{items.map((item) => (
5959
<div className="a-items-center" id="checkbox-content" key={item.id}>
@@ -64,12 +64,17 @@ const PurchaseCheckBox = ({ setCheckBoxCondition, isPerformSelected }) => {
6464
id="checkbox"
6565
onClick={() => onChangeCheckbox(item.id)}
6666
/>
67-
<label className="p-small-medium c-pointer" onClick={() => onChangeCheckbox(item.id)}>
67+
<label
68+
className="p-small-medium cursor-pointer whitespace-nowrap"
69+
onClick={() => onChangeCheckbox(item.id)}
70+
>
6871
{item.name}
6972
</label>
7073
<p
71-
className="p-xs-under c-pointer"
72-
onClick={() => setShowPopup({ ...showPopup, [item.key]: !showPopup[item.key] })}
74+
className="p-xs-under cursor-pointer whitespace-nowrap"
75+
onClick={() =>
76+
setShowPopup({ ...showPopup, [item.key]: !showPopup[item.key] })
77+
}
7378
>
7479
자세히 보기
7580
</p>
@@ -78,7 +83,8 @@ const PurchaseCheckBox = ({ setCheckBoxCondition, isPerformSelected }) => {
7883
{React.cloneElement(item.popup, {
7984
title: item.name,
8085
detail: item.detail,
81-
setShowPopup: (state) => setShowPopup({ ...showPopup, [item.key]: state }),
86+
setShowPopup: (state) =>
87+
setShowPopup({ ...showPopup, [item.key]: state }),
8288
page: item.id === 1 ? 1 : 2,
8389
isPerformSelected,
8490
})}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import useWindowDimensions from "@/hooks/useWindowDimensions";
2+
import SmallOnOffBtn from "../button/RoundBtn_135_40";
3+
4+
interface PurchaseMethodBtnProps {
5+
children: string;
6+
isSelected: boolean;
7+
onClick: () => void;
8+
}
9+
10+
const PurchaseMethodBtn = ({
11+
children,
12+
isSelected,
13+
onClick,
14+
}: PurchaseMethodBtnProps) => {
15+
const { isTablet } = useWindowDimensions().widthConditions;
16+
return (
17+
<SmallOnOffBtn
18+
color={isSelected ? "purple" : "grey"}
19+
onClick={onClick}
20+
style={{
21+
width: !isTablet ? "108px" : "128px",
22+
height: "36px",
23+
border: isSelected ? "3px solid var(--purple-purple-7, #B489FF)" : "",
24+
}}
25+
>
26+
{children}
27+
</SmallOnOffBtn>
28+
);
29+
};
30+
31+
export default PurchaseMethodBtn;

src/constants/PopupTexts/PurchaseDetailTexts.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const PURCHASE_AGREEMENT = `제1조(목적)
2828
② 권리자는 대상저작물이 다른 제3자의 저작권 등 지식재산권 및 기타의 권리를 침해하지 않음을 진술 및 보증한다.
2929
3030
제9조(약관의 해지)
31-
① 당사자는 상대방이 정당한 이유 없이 본 약관을 위반하는 경우, 상당한 기간을 정하여 상대방에게 그 시정을 촉구하고, 상대방이 그 기간이 지나도록 의무 위반을 시정하지 아니하는 경우에는 약관을 해지할 수 있다. 다만, 상대방이 명백한 시정 거부의사를 표시하였거나 위반 사항의 성격상 시정이 불가능하다는 것이 명백히 인정되는 경우에는 촉구없이 약관을 해지할 수 있다
31+
① 당사자는 상대방이 정당한 이유 없이 본 약관을 위반하는 경우, 상당한 기간을 정하여 상대방에게 그 시정을 촉구하고, 상대방이 그 기간이 지나도록 의무 위반을 시정하지 아니하는 경우에는 약관을 해지할 수 있다. 다만, 상대방이 명백한 시정 거부의사를 표시하였거나 위반 사항의 성격상 시정이 불가능하다는 것이 명백히 인정되는 경우에는 촉구없이 약관을 해지할 수 있다.
3232
② 권리자는 다음 각 호의 경우 본 약관을 즉시 해지할 수 있다.
3333
1. 이용자의 회생절차의 개시 결정
3434
2. 이용자의 파산선고
@@ -46,8 +46,7 @@ export const PURCHASE_AGREEMENT = `제1조(목적)
4646
제11조(손해배상)
4747
당사자가 정당한 이유 없이 본 약관을 위반하는 경우, 그로 인하여 다른 당사자에게 발생한 모든 손해를 배상할 책임이 있다.
4848
49-
제12조(불가항력) 천재지변, 전쟁, 폭동, 감염병 등의 불가항력적 사유로 당사자가 본 약관상 의무를 이행하지 못하거나 지체하는 경우에는 서로의 책임을 면제하며, 상호 합의
50-
하여 약관 내용을 공평하게 변경한다.
49+
제12조(불가항력) 천재지변, 전쟁, 폭동, 감염병 등의 불가항력적 사유로 당사자가 본 약관상 의무를 이행하지 못하거나 지체하는 경우에는 서로의 책임을 면제하며, 상호 합의하여 약관 내용을 공평하게 변경한다.
5150
5251
제13조(분쟁해결)
5352
① 본 약관과 관련하여 분쟁이 발생한 경우 당사자는 상호 협의하여 분쟁을 해결하기 위하여 노력한다.
@@ -61,11 +60,6 @@ export const PURCHASE_AGREEMENT = `제1조(목적)
6160
본 약관에 명시되지 않은 사항은 당사자가 성의를 갖고 상호 협의를 통해 결정하되, 이견이 있을 경우에는 저작권법 등 관련 법령, 일반적인 상관례 및 약관 해석의 원칙에 따른다.
6261
`;
6362

64-
export const REFUND_POLICY = ` 대본은 구매 후 청약철회가 불가합니다. 구매 시점부터
65-
1년간 자유롭게 다운로드 가능합니다.
63+
export const REFUND_POLICY = ` 대본은 구매 후 청약철회가 불가합니다. 구매 시점부터 1년간 자유롭게 다운로드 가능합니다.
6664
67-
공연권은 구매 후 2주 이내, 미 공연시에만 환불이
68-
가능합니다. 2주가 지나지 않았더라도 공연이
69-
이루어졌다면 환불이 불가합니다. 또한, 공연권 행사
70-
기간은 구매일로부터 1년 안에만 가능합니다. 1년 이내 미공연 시 공연권의 행사가 불가하오니 유의하시기
71-
바랍니다. `;
65+
공연권은 구매 후 2주 이내, 미 공연시에만 환불이 가능합니다. 2주가 지나지 않았더라도 공연이 이루어졌다면 환불이 불가합니다. 또한, 공연권 행사 기간은 구매일로부터 1년 안에만 가능합니다. 1년 이내 미공연 시 공연권의 행사가 불가하오니 유의하시기 바랍니다. `;

src/pages/payment/Purchase.jsx

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import performImg from "./../../assets/image/post/list/perform.svg";
3232
import "./Purchase.scss";
3333
import "./../../styles/utilities.css";
3434
import AmountChangePurchase from "@/components/detail/AmountChangePurchase";
35+
import PurchaseMethodBtn from "@/components/purchase/PurchaseMethodBtn";
3536

3637
const Purchase = () => {
3738
const [thumbnailImg, setThumbnailImg] = useState("");
@@ -60,6 +61,7 @@ const Purchase = () => {
6061
const [address, setAddress] = useState("");
6162
const [addressValid, setAddressValid] = useState(false);
6263

64+
const [method, setMethod] = useState(0); // 0: 계좌 이체, 1: 신용카드, 2: 가상계좌
6365
const [checkBoxCondition, setCheckBoxCondition] = useState({
6466
purchaseAgreement: false,
6567
refundPolicy: false,
@@ -353,43 +355,34 @@ const Purchase = () => {
353355
<p className="p-medium-bold sm:p-large-bold whitespace-nowrap">
354356
결제 방법
355357
</p>
356-
{768 < width && width <= 1280 && (
357-
<p className="p-small-bold c-grey4 whitespace-nowrap">
358-
계좌 이체 방법은 메일로 전송됩니다.
359-
</p>
360-
)}
361358
</div>
362-
<div className="btn-wrap d-flex">
363-
<SmallOnOffBtn
364-
style={{
365-
width: "108px",
366-
height: "36px",
367-
border: "3px solid var(--purple-purple-7, #B489FF)",
359+
<div className="btn-wrap grid grid-cols-[repeat(2,max-content)] gap-x-[24px] gap-y-[15px] sm:grid-cols-[repeat(3,max-content)] sm:gap-[19px] md:grid-cols-[repeat(2,max-content)] md:gap-x-[14px] md:gap-y-[26px] xl:grid-cols-[repeat(3,max-content)] xl:gap-[19px]">
360+
<PurchaseMethodBtn
361+
isSelected={method === 0}
362+
onClick={() => {
363+
setMethod(0);
368364
}}
369365
>
370366
계좌 이체
371-
</SmallOnOffBtn>
372-
<SmallOnOffBtn
373-
disabled={true}
374-
style={{ width: "108px", height: "36px" }}
367+
</PurchaseMethodBtn>
368+
<PurchaseMethodBtn
369+
isSelected={method === 1}
370+
onClick={() => {
371+
setMethod(1);
372+
}}
375373
>
376-
-
377-
</SmallOnOffBtn>
378-
{!isSmallMobile && (
379-
<SmallOnOffBtn
380-
disabled={true}
381-
style={{ width: "108px", height: "36px" }}
382-
>
383-
-
384-
</SmallOnOffBtn>
385-
)}
374+
신용카드
375+
</PurchaseMethodBtn>
376+
<PurchaseMethodBtn
377+
isSelected={method === 2}
378+
onClick={() => {
379+
setMethod(2);
380+
}}
381+
>
382+
가상계좌
383+
</PurchaseMethodBtn>
386384
</div>
387385
</div>
388-
{(width <= 768 || width > 1280) && (
389-
<p className="p-12-bold sm:p-small-bold c-grey4 t-align-center">
390-
계좌 이체 방법은 메일로 전송됩니다.
391-
</p>
392-
)}
393386
</div>
394387
</div>
395388

0 commit comments

Comments
 (0)