Skip to content

Commit a5cc391

Browse files
committed
Refactor: BitnagilAlert 디자인 v2 적용 (#T3-185)
1 parent 675f53a commit a5cc391

2 files changed

Lines changed: 31 additions & 57 deletions

File tree

Projects/Presentation/Sources/Common/View/BitnagilAlert.swift

Lines changed: 29 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -9,54 +9,43 @@ import SnapKit
99
import UIKit
1010

1111
final class BitnagilAlert: UIViewController {
12-
enum AlertType {
13-
case withImage
14-
case plainText
15-
}
16-
1712
private enum Layout {
18-
static let contentViewHorizontalSpacing: CGFloat = 39
19-
static let contentViewHorizontalHeight: CGFloat = 154
20-
static let imageSize: CGFloat = 55
21-
static let imageTopSpacing: CGFloat = 24
22-
static let titleTopSpacing: CGFloat = 18
23-
static let titleHeight: CGFloat = 30
24-
static let contentTopSpacing: CGFloat = 2
25-
static let contentHeight: CGFloat = 18
13+
static let horizontalMargin: CGFloat = 24
14+
static let contentViewHorizontalSpacing: CGFloat = 44
15+
static let contentViewHorizontalHeight: CGFloat = 180
16+
static let titleTopSpacing: CGFloat = 20
17+
static let titleHeight: CGFloat = 28
18+
static let contentTopSpacing: CGFloat = 6
19+
static let contentHeight: CGFloat = 40
2620
static let buttonTopSpacing: CGFloat = 18
27-
static let buttonHorizontalSpacing: CGFloat = 20
28-
static let buttonHeight: CGFloat = 44
29-
static let confirmButtonLeadingSpacing: CGFloat = 8
30-
static let buttonBottomSpacing: CGFloat = 24
21+
static let buttonHeight: CGFloat = 48
22+
static let confirmButtonLeadingSpacing: CGFloat = 12
23+
static let buttonBottomSpacing: CGFloat = 20
3124
}
3225

3326
private let dimmedView = UIView()
3427
private let contentView = UIView()
35-
private let alertImageView = UIImageView()
3628
private let titleLabel = UILabel()
3729
private let contentLabel = UILabel()
3830
private let cancelButton = UIButton()
3931
private let confirmButton = UIButton()
40-
private let alertType: AlertType
4132
private var cancelHandler: (() -> Void)?
4233
private var confirmHandler: (() -> Void)?
4334

4435
init(
45-
alertType: AlertType,
4636
title: String,
4737
content: String,
4838
cancelButtonTitle: String,
4939
confirmButtonTitle: String,
5040
cancelHandler: (() -> Void)?,
5141
confirmHandler: (() -> Void)?
5242
) {
53-
self.alertType = alertType
5443
super.init(nibName: nil, bundle: nil)
5544

5645
self.cancelHandler = cancelHandler
5746
self.confirmHandler = confirmHandler
5847
titleLabel.text = title
59-
contentLabel.text = content
48+
contentLabel.attributedText = BitnagilFont(style: .body2, weight: .medium).attributedString(text: content)
6049
cancelButton.setTitle(cancelButtonTitle, for: .normal)
6150
confirmButton.setTitle(confirmButtonTitle, for: .normal)
6251

@@ -77,21 +66,22 @@ final class BitnagilAlert: UIViewController {
7766
dimmedView.alpha = 0.7
7867

7968
contentView.backgroundColor = .white
80-
contentView.layer.cornerRadius = 20
69+
contentView.layer.cornerRadius = 12
8170
contentView.layer.masksToBounds = true
8271

83-
alertImageView.image = BitnagilIcon.exclamationFilledIcon
84-
titleLabel.font = BitnagilFont(style: .title2, weight: .bold).font
85-
contentLabel.font = BitnagilFont(style: .caption1, weight: .regular).font
72+
titleLabel.font = BitnagilFont(style: .subtitle1, weight: .semiBold).font
73+
titleLabel.textColor = BitnagilColor.gray10
74+
75+
contentLabel.textColor = BitnagilColor.gray40
76+
contentLabel.numberOfLines = 2
8677

87-
cancelButton.backgroundColor = .white
88-
cancelButton.setTitleColor(BitnagilColor.navy500, for: .normal)
89-
confirmButton.backgroundColor = BitnagilColor.navy500
78+
cancelButton.backgroundColor = BitnagilColor.gray97
79+
cancelButton.setTitleColor(BitnagilColor.gray40, for: .normal)
80+
confirmButton.backgroundColor = BitnagilColor.gray10
9081
confirmButton.setTitleColor(.white, for: .normal)
9182
[cancelButton, confirmButton].forEach {
92-
$0.titleLabel?.font = BitnagilFont(style: .subtitle1, weight: .bold).font
93-
$0.layer.borderWidth = 1
94-
$0.layer.cornerRadius = 8
83+
$0.titleLabel?.font = BitnagilFont(style: .body2, weight: .medium).font
84+
$0.layer.cornerRadius = 12
9585
$0.layer.masksToBounds = true
9686
}
9787

@@ -129,44 +119,29 @@ final class BitnagilAlert: UIViewController {
129119
make.height.equalTo(Layout.contentViewHorizontalHeight).priority(.medium)
130120
}
131121

132-
if alertType == .withImage {
133-
contentView.addSubview(alertImageView)
134-
alertImageView.snp.makeConstraints { make in
135-
make.top.equalToSuperview().offset(Layout.imageTopSpacing)
136-
make.centerX.equalToSuperview()
137-
make.size.equalTo(Layout.imageSize)
138-
}
139-
140-
titleLabel.snp.makeConstraints { make in
141-
make.top.equalTo(alertImageView.snp.bottom).offset(Layout.titleTopSpacing)
142-
make.centerX.equalToSuperview()
143-
make.height.equalTo(Layout.titleHeight)
144-
}
145-
} else {
146-
titleLabel.snp.makeConstraints { make in
147-
make.top.equalToSuperview().offset(Layout.titleTopSpacing)
148-
make.centerX.equalToSuperview()
149-
make.height.equalTo(Layout.titleHeight)
150-
}
122+
titleLabel.snp.makeConstraints { make in
123+
make.top.equalToSuperview().offset(Layout.titleTopSpacing)
124+
make.horizontalEdges.equalToSuperview().inset(Layout.horizontalMargin)
125+
make.height.equalTo(Layout.titleHeight)
151126
}
152127

153128
contentLabel.snp.makeConstraints { make in
154129
make.top.equalTo(titleLabel.snp.bottom).offset(Layout.contentTopSpacing)
155-
make.centerX.equalToSuperview()
130+
make.horizontalEdges.equalToSuperview().inset(Layout.horizontalMargin)
156131
make.height.equalTo(Layout.contentHeight)
157132
}
158133

159134
cancelButton.snp.makeConstraints { make in
160135
make.top.equalTo(contentLabel.snp.bottom).offset(Layout.buttonTopSpacing)
161-
make.leading.equalToSuperview().offset(Layout.buttonHorizontalSpacing)
136+
make.leading.equalToSuperview().offset(Layout.horizontalMargin)
162137
make.height.equalTo(Layout.buttonHeight)
163138
make.bottom.equalToSuperview().inset(Layout.buttonBottomSpacing)
164139
}
165140

166141
confirmButton.snp.makeConstraints { make in
167142
make.top.equalTo(contentLabel.snp.bottom).offset(Layout.buttonTopSpacing)
168143
make.leading.equalTo(cancelButton.snp.trailing).offset(Layout.confirmButtonLeadingSpacing)
169-
make.trailing.equalToSuperview().inset(Layout.buttonHorizontalSpacing)
144+
make.trailing.equalToSuperview().inset(Layout.horizontalMargin)
170145
make.height.equalTo(Layout.buttonHeight)
171146
make.width.equalTo(cancelButton)
172147
make.bottom.equalToSuperview().inset(Layout.buttonBottomSpacing)

Projects/Presentation/Sources/Setting/View/SettingView.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,8 @@ extension SettingView: UITableViewDelegate {
259259
switch row {
260260
case .logout:
261261
alert = BitnagilAlert(
262-
alertType: .withImage,
263-
title: "로그아웃 하시겠어요?",
264-
content: "버튼을 누르면 로그인 페이지로 이동해요.",
262+
title: "로그아웃할까요?",
263+
content: "이 기기에서 계정이 로그아웃되고, 다시\n로그인해야 서비스를 계속 이용할 수 있어요.",
265264
cancelButtonTitle: "취소",
266265
confirmButtonTitle: "로그아웃",
267266
cancelHandler: nil,

0 commit comments

Comments
 (0)