Skip to content

Commit

Permalink
Refactor(#103): LoginView, AccountLoginView 2025버젼으로 리팩토링
Browse files Browse the repository at this point in the history
1. UIFont.CustomFont 적용완료
2. CustomTextField 수정(Utilities에서 inputContainerTextField를 삭제하고 바로 CustomTextField 사용하도록 변경)
  • Loading branch information
jungseok-corine committed Jan 27, 2025
1 parent 56d93da commit 512551a
Show file tree
Hide file tree
Showing 22 changed files with 187 additions and 159 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class AccountSearchView: UIView {

private let emailLabel = CustomLabel(UILabel_NotoSans: .medium, text: "이메일 주소", textColor: .color51, fontSize: 12)

let emailTextField = Utilities.inputContainerTextField(withPlaceholder: "이메일")
let emailTextField = CustomTextField(placeholder: "이메일")
// Utilities.inputContainerTextField(withPlaceholder: "이메일")

let requestAuthButton = CustomButton(title: "인증요청", backgroundColor: .brandColor, titleColor: .white, font: UIFont.pretendard(NotoSans: .medium, fontSize: 14))

Expand All @@ -40,7 +41,8 @@ class AccountSearchView: UIView {
return stackView
}()

let authNumberTextField = Utilities.inputContainerTextField(withPlaceholder: "인증코드 입력")
let authNumberTextField = CustomTextField(placeholder: "인증코드 입력")
// Utilities.inputContainerTextField(withPlaceholder: "인증코드 입력")

let timer: UILabel = {
let label = UILabel()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class PasswordResetView: UIView {

private let passwordLabel = CustomLabel(UILabel_NotoSans: .medium, text: "비밀번호", textColor: .color51, fontSize: 12)

let resetPasswordTextField = Utilities.inputContainerTextField(withPlaceholder: "비밀번호")
let resetPasswordTextField = CustomTextField(placeholder: "비밀번호")
// Utilities.inputContainerTextField(withPlaceholder: "비밀번호")

let resetPasswordDescription: UILabel = {
let label = UILabel()
Expand All @@ -30,7 +31,8 @@ class PasswordResetView: UIView {
return stackView
}()

let checkPasswordTextField = Utilities.inputContainerTextField(withPlaceholder: "비밀번호 확인")
let checkPasswordTextField = CustomTextField(placeholder: "비밀번호 확인")
// Utilities.inputContainerTextField(withPlaceholder: "비밀번호 확인")

let checkPasswordDescription: UILabel = {
let label = UILabel()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AccountLoginController: UIViewController {

private func setupActions() {
accountLoginView.loginButton.addTarget(self, action: #selector(loginButtonTapped), for: .touchUpInside)
accountLoginView.findAccountButton.button.addTarget(self, action: #selector(findAccountButtonTapped), for: .touchUpInside)
accountLoginView.findAccountButton.addTarget(self, action: #selector(findAccountButtonTapped), for: .touchUpInside)
accountLoginView.signupButton.addTarget(self, action: #selector(registerAccountButtonTapped), for: .touchUpInside)

accountLoginView.emailTextField.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged)
Expand Down Expand Up @@ -98,6 +98,6 @@ class AccountLoginController: UIViewController {
private func updateStatus(label: UILabel?, message: String, isAvailable: Bool, textField: UITextField?) {
label?.text = message
label?.textColor = isAvailable ? .brandColor : .error
textField?.layer.borderColor = isAvailable ? UIColor.color212.cgColor : UIColor.error.cgColor
textField?.layer.borderColor = isAvailable ? UIColor.brandMain.cgColor : UIColor.error.cgColor
}
}
36 changes: 19 additions & 17 deletions Where_Are_You/Presentation/Login/Login/Views/AccountLoginView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import SnapKit
class AccountLoginView: UIView {
// MARK: - Properties

private let titleLabel = CustomLabel(UILabel_NotoSans: .bold, text: "로그인하기", textColor: .black22, fontSize: 22)
private let titleLabel = StandardLabel(UIFont: UIFont.CustomFont.titleH1(text: "로그인하기", textColor: .black22))

private let emailLabel = CustomLabel(UILabel_NotoSans: .medium, text: "이메일 주소", textColor: .color51, fontSize: 12)
private let emailLabel = StandardLabel(UIFont: UIFont.CustomFont.bodyP5(text: " 이메일 주소", textColor: .black22))

let emailTextField = Utilities.inputContainerTextField(withPlaceholder: "이메일을 입력해주세요.")
let emailTextField = CustomTextField(placeholder: "이메일을 입력해주세요.")

let emailErrorLabel: UILabel = {
let label = UILabel()
Expand All @@ -27,29 +27,31 @@ class AccountLoginView: UIView {
lazy var idStack: UIStackView = {
let stack = UIStackView(arrangedSubviews: [emailLabel, emailTextField, emailErrorLabel])
stack.axis = .vertical
stack.spacing = LayoutAdapter.shared.scale(value: 4)
return stack
}()

private let passwordLabel = CustomLabel(UILabel_NotoSans: .medium, text: "비밀번호", textColor: .color51, fontSize: 12)
private let passwordLabel = StandardLabel(UIFont: UIFont.CustomFont.bodyP5(text: " 비밀번호", textColor: .black22))

let passwordTextField = Utilities.inputContainerTextField(withPlaceholder: "비밀번호를 입력해주세요.")
let passwordTextField = CustomTextField(placeholder: "비밀번호를 입력해주세요.")

lazy var passwordStack: UIStackView = {
let stack = UIStackView(arrangedSubviews: [passwordLabel, passwordTextField])
stack.axis = .vertical
stack.spacing = LayoutAdapter.shared.scale(value: 4)
return stack
}()

lazy var stack: UIStackView = {
let stack = UIStackView(arrangedSubviews: [idStack, passwordStack])
stack.spacing = 10
stack.spacing = LayoutAdapter.shared.scale(value: 16)
stack.axis = .vertical
return stack
}()

let loginButton = CustomButton(title: "로그인하기", backgroundColor: .color171, titleColor: .color242, font: UIFont.pretendard(NotoSans: .bold, fontSize: 18))
let loginButton = TitleButton(title: UIFont.CustomFont.button18(text: "로그인하기", textColor: .white), backgroundColor: .blackAC, borderColor: nil, cornerRadius: 8)

let findAccountButton = CustomButtonView(text: "계정찾기", weight: .medium, textColor: .black66, fontSize: 14)
let findAccountButton = StandardButton(text: UIFont.CustomFont.bodyP4(text: "계정찾기", textColor: .black66))

let signupButton = Utilities.attributedButton("계정이 없으신가요?", " 가입하기")

Expand Down Expand Up @@ -79,30 +81,30 @@ class AccountLoginView: UIView {

private func setupConstraints() {
titleLabel.snp.makeConstraints { make in
make.top.equalToSuperview().offset(34)
make.leading.equalToSuperview().offset(21)
make.top.equalToSuperview().inset(LayoutAdapter.shared.scale(value: 54))
make.leading.equalToSuperview().inset(LayoutAdapter.shared.scale(value: 24))
}

stack.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.top.equalTo(titleLabel.snp.bottom).offset(30)
make.leading.equalToSuperview().offset(21)
make.leading.equalToSuperview().inset(LayoutAdapter.shared.scale(value: 24))
}

loginButton.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.top.equalTo(stack.snp.bottom).offset(30)
make.top.equalTo(stack.snp.bottom).offset(LayoutAdapter.shared.scale(value: 68))
make.leading.equalTo(stack.snp.leading)
make.height.equalTo(loginButton.snp.width).multipliedBy(0.145)
make.height.equalTo(LayoutAdapter.shared.scale(value: 48))
}

findAccountButton.snp.makeConstraints { make in
make.top.equalTo(loginButton.snp.bottom).offset(26)
make.top.equalTo(loginButton.snp.bottom).offset(LayoutAdapter.shared.scale(value: 31))
make.centerX.equalToSuperview()
}

signupButton.snp.makeConstraints { make in
make.top.equalTo(findAccountButton.snp.bottom).offset(14)
make.top.equalTo(findAccountButton.snp.bottom).offset(LayoutAdapter.shared.scale(value: 20))
make.centerX.equalToSuperview()
}
}
Expand All @@ -112,10 +114,10 @@ class AccountLoginView: UIView {
let isPasswordEntered = !(passwordTextField.text?.isEmpty ?? true)

if isUserIdEntered && isPasswordEntered {
loginButton.updateBackgroundColor(.brandColor)
loginButton.updateBackgroundColor(.brandMain)
loginButton.isEnabled = true
} else {
loginButton.updateBackgroundColor(.color171)
loginButton.updateBackgroundColor(.blackAC)
loginButton.isEnabled = false
}
}
Expand Down
47 changes: 34 additions & 13 deletions Where_Are_You/Presentation/Login/Login/Views/LoginView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,48 @@ class LoginView: UIView {
return imageView
}()

private let subtitleLabel = StandardLabel(UIFont: UIFont.CustomFont.bodyP4(text: "위치기반 일정관리 플랫폼"), textColor: .black22)
private let subtitleLabel = StandardLabel(UIFont: UIFont.CustomFont.bodyP4(text: "위치기반 일정관리 플랫폼", textColor: .black22))

let kakaoLogin: UIButton = {
let button = UIButton()
let label = StandardLabel(UIFont: UIFont.CustomFont.button16(text: "카카오로 시작하기"), textColor: .black22)
let iconImage = UIImage(systemName: "message.fill")
button.setImage(iconImage, for: .normal)
button.setAttributedTitle(UIFont.CustomFont.button16(text: "카카오로 시작하기"), for: .normal)
var configuration = UIButton.Configuration.plain()

configuration.image = UIImage(named: "kakao")
configuration.imagePlacement = .leading
configuration.imagePadding = 10

let nsAttributedString = UIFont.CustomFont.button16(text: "카카오로 시작하기", textColor: .black22)
configuration.attributedTitle = AttributedString(nsAttributedString)
configuration.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 10)

button.configuration = configuration
button.backgroundColor = .secondaryNormal
button.layer.cornerRadius = 8
button.clipsToBounds = true
return button
}()

let appleLogin: ASAuthorizationAppleIDButton = {
let button = ASAuthorizationAppleIDButton(type: .default, style: .black)
let appleLogin: UIButton = {
let button = UIButton()
var configuration = UIButton.Configuration.plain()

button.cornerRadius = 8
configuration.image = UIImage(systemName: "apple.logo")?.withTintColor(.white, renderingMode: .alwaysOriginal)

configuration.imagePlacement = .leading
configuration.imagePadding = 10

let nsAttributedString = UIFont.CustomFont.button16(text: "Apple로 로그인", textColor: .white)
configuration.attributedTitle = AttributedString(nsAttributedString)
configuration.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 10)

button.configuration = configuration
button.backgroundColor = .black
button.layer.cornerRadius = 8
button.clipsToBounds = true
return button
}()

let accountLogin = TitleButton(title: UIFont.CustomFont.button14(text: "이메일 로그인"), backgroundColor: .white, titleColor: .brandDark, borderColor: UIColor.brandMain.cgColor, cornerRadius: 8)
let accountLogin = TitleButton(title: UIFont.CustomFont.button14(text: "이메일 로그인", textColor: .brandDark), backgroundColor: .white, borderColor: UIColor.brandMain.cgColor, cornerRadius: 8)

private lazy var loginStack: UIStackView = {
let stackView = UIStackView(arrangedSubviews: [kakaoLogin, appleLogin, accountLogin])
Expand All @@ -47,11 +68,11 @@ class LoginView: UIView {
return stackView
}()

let separatorLabel = StandardLabel(UIFont: UIFont.CustomFont.bodyP4(text: "또는"), textColor: .black66)
let separatorLabel = StandardLabel(UIFont: UIFont.CustomFont.bodyP4(text: "또는", textColor: .black66))

let signupButton = StandardButton(text: UIFont.CustomFont.bodyP4(text: "회원가입"), textColor: .black66)
let findAccountButton = StandardButton(text: UIFont.CustomFont.bodyP4(text: "계정찾기"), textColor: .black66)
let inquiryButton = StandardButton(text: UIFont.CustomFont.bodyP4(text: "문의하기"), textColor: .black66)
let signupButton = StandardButton(text: UIFont.CustomFont.bodyP4(text: "회원가입", textColor: .black66))
let findAccountButton = StandardButton(text: UIFont.CustomFont.bodyP4(text: "계정찾기", textColor: .black66))
let inquiryButton = StandardButton(text: UIFont.CustomFont.bodyP4(text: "문의하기", textColor: .black66))

private lazy var buttonStack: UIStackView = {
let stackView = UIStackView(arrangedSubviews: [signupButton, findAccountButton, inquiryButton])
Expand Down
15 changes: 10 additions & 5 deletions Where_Are_You/Presentation/Login/SingUp/Views/SignUpFormView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ class SignUpFormView: UIView {

private let userNameLabel = CustomLabel(UILabel_NotoSans: .medium, text: "이름", textColor: .color51, fontSize: LayoutAdapter.shared.scale(value: 12))

let userNameTextField = Utilities.inputContainerTextField(withPlaceholder: "이름")
let userNameTextField = CustomTextField(placeholder: "이름")
// Utilities.inputContainerTextField(withPlaceholder: "이름")

let userNameErrorLabel: UILabel = {
let label = UILabel()
Expand All @@ -48,7 +49,8 @@ class SignUpFormView: UIView {

private let emailLabel = CustomLabel(UILabel_NotoSans: .medium, text: "이메일", textColor: .color51, fontSize: LayoutAdapter.shared.scale(value: 12))

let emailTextField = Utilities.inputContainerTextField(withPlaceholder: "이메일")
let emailTextField = CustomTextField(placeholder: "이메일")
// Utilities.inputContainerTextField(withPlaceholder: "이메일")

let emailCheckButton = CustomButton(title: "인증요청", backgroundColor: .brandColor, titleColor: .white, font: UIFont.pretendard(NotoSans: .medium, fontSize: 14))

Expand All @@ -74,7 +76,8 @@ class SignUpFormView: UIView {
return stackView
}()

let authCodeTextField = Utilities.inputContainerTextField(withPlaceholder: "인증코드")
let authCodeTextField = CustomTextField(placeholder: "인증코드")
// Utilities.inputContainerTextField(withPlaceholder: "인증코드")

let timer: UILabel = {
let label = UILabel()
Expand Down Expand Up @@ -110,7 +113,8 @@ class SignUpFormView: UIView {

let passwordLabel = CustomLabel(UILabel_NotoSans: .medium, text: "비밀번호", textColor: .color51, fontSize: LayoutAdapter.shared.scale(value: 12))

let passwordTextField = Utilities.inputContainerTextField(withPlaceholder: "비밀번호")
let passwordTextField = CustomTextField(placeholder: "비밀번호")
// Utilities.inputContainerTextField(withPlaceholder: "비밀번호")

let passwordErrorLabel: UILabel = {
let label = UILabel()
Expand All @@ -120,7 +124,8 @@ class SignUpFormView: UIView {
return label
}()

let checkPasswordTextField = Utilities.inputContainerTextField(withPlaceholder: "비밀번호 확인")
let checkPasswordTextField = CustomTextField(placeholder: "비밀번호 확인")
// Utilities.inputContainerTextField(withPlaceholder: "비밀번호 확인")

let checkPasswordErrorLabel: UILabel = {
let label = UILabel()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,7 @@ class CommonFeedView: UIView {
let feedImageInfos = feed.feedImageInfos ?? []
self.imageUrls = feedImageInfos.map { $0.feedImageURL }
feedImagesView.collectionView.reloadData()
if imageUrls.count <= 1 {
feedImagesView.pageNumberLabel.isHidden = true
} else {
feedImagesView.pageNumberLabel.isHidden = false
feedImagesView.pageNumberLabel.text = "1/\(imageUrls.count)"
}
feedImagesView.pageNumberLabel.text = "1/\(imageUrls.count)"
self.feed = feed
profileImageURL = feed.profileImageURL
feedSeq = feed.feedSeq
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class FeedsTableViewCell: UITableViewCell {
descriptionLabel.isHidden = (feed.content == nil)
// descriptionLabel.text = feed.content
guard let feedcontent = feed.content else { return }
descriptionLabel.attributedText = UIFont.CustomFont.bodyP4(text: feedcontent)
descriptionLabel.attributedText = UIFont.CustomFont.bodyP4(text: feedcontent, textColor: .black66)
let readmoreFont = UIFont.pretendard(NotoSans: .medium, fontSize: 14)
let readmoreFontColor = UIColor.color153
descriptionLabel.numberOfLines = isExpanded ? 0 : 3
Expand All @@ -137,13 +137,7 @@ class FeedsTableViewCell: UITableViewCell {
let feedImageInfos = feed.feedImageInfos ?? []
self.imageUrls = feedImageInfos.map { $0.feedImageURL }
feedImagesView.collectionView.reloadData()
if imageUrls.count <= 1 {
feedImagesView.pageNumberLabel.isHidden = true
} else {
feedImagesView.pageNumberLabel.isHidden = false
feedImagesView.pageNumberLabel.text = "1/\(imageUrls.count)"
}

feedImagesView.pageNumberLabel.text = "1/\(imageUrls.count)"
self.feed = feed
profileImageURL = feed.profileImageURL
feedSeq = feed.feedSeq
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,6 @@ extension BottomSheetViewController: UITableViewDataSource, UITableViewDelegate

extension BottomSheetViewController: DailyScheduleTableViewCellDelegate {
func didTapCheckLocationButton(schedule: Schedule) {

let notificationView = NotificationView()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class MainHomeViewController: UIViewController {

private func setupNavigationBar() {
navigationItem.leftBarButtonItem = UIBarButtonItem(customView: titleView.titleLabel)
navigationItem.rightBarButtonItem = UIBarButtonItem(customView: titleView.iconStack)
navigationItem.rightBarButtonItem = UIBarButtonItem(customView: titleView.notificationButton)

// 화면을 스크롤 했을때 네비게이션바가 여전히 색상을 유지
let navigationBarAppearance = UINavigationBarAppearance()
Expand All @@ -71,7 +71,6 @@ class MainHomeViewController: UIViewController {

private func setupActions() {
titleView.notificationButton.addTarget(self, action: #selector(moveToNotification), for: .touchUpInside)
titleView.profileButton.addTarget(self, action: #selector(moveToMyPage), for: .touchUpInside)
}

private func addAndLayoutChildViewController(_ child: UIViewController, toView containerView: UIView) {
Expand All @@ -90,8 +89,4 @@ class MainHomeViewController: UIViewController {
hostingController.modalPresentationStyle = .fullScreen
present(hostingController, animated: true)
}

@objc private func moveToMyPage() {
tabBarController?.selectedIndex = 3
}
}
7 changes: 4 additions & 3 deletions Where_Are_You/Presentation/Main/Home/Views/HomeFeedView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ class HomeFeedView: UIView {
label.font = UIFont.pretendard(NotoSans: .medium, fontSize: 14)
label.numberOfLines = 0
label.textAlignment = .center
label.layer.borderColor = UIColor.color221.cgColor
label.layer.borderWidth = 1
label.layer.cornerRadius = LayoutAdapter.shared.scale(value: 15)
label.layer.borderColor = UIColor.blackF0.cgColor
label.backgroundColor = .white
label.layer.borderWidth = 1.5
label.layer.cornerRadius = LayoutAdapter.shared.scale(value: 12)
label.clipsToBounds = true
return label
}()
Expand Down
15 changes: 0 additions & 15 deletions Where_Are_You/Presentation/Main/Home/Views/TitleView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,4 @@ class TitleView: UIView {
}
return button
}()

let profileButton: UIButton = {
let button = UIButton()
button.snp.makeConstraints { make in
make.height.width.equalTo(LayoutAdapter.shared.scale(value: 34))
}
button.setImage(UIImage(named: "icon-mypage"), for: .normal)
return button
}()

lazy var iconStack: UIStackView = {
let stackView = UIStackView(arrangedSubviews: [notificationButton, profileButton])
stackView.axis = .horizontal
return stackView
}()
}
Loading

0 comments on commit 512551a

Please sign in to comment.