Skip to content

Commit

Permalink
Merge pull request #134 from IIION/feature/loginViewReDesign
Browse files Browse the repository at this point in the history
✨ 로그인 버튼의 디자인을 변경했습니다.
  • Loading branch information
jeohong authored Dec 4, 2022
2 parents 663ad57 + b8c9fda commit c76c480
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 33 deletions.
4 changes: 4 additions & 0 deletions Workade.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
2170C28F292BB0BC005146C3 /* ExploreViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2170C28E292BB0BC005146C3 /* ExploreViewController.swift */; };
2170C291292C974B005146C3 /* ExploreViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2170C290292C974B005146C3 /* ExploreViewModel.swift */; };
2170C293292CA689005146C3 /* RegionInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2170C292292CA689005146C3 /* RegionInfoView.swift */; };
21723FB8293BA3800064255C /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 21723FB7293BA3800064255C /* GoogleService-Info.plist */; };
21862A912902675600518EBC /* GalleryDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21862A902902675500518EBC /* GalleryDetailViewController.swift */; };
21862A93290280BD00518EBC /* CardTransitionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21862A92290280BD00518EBC /* CardTransitionManager.swift */; };
218DA403290B1AA90089F896 /* LaunchScreenAnimationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 218DA402290B1AA90089F896 /* LaunchScreenAnimationView.swift */; };
Expand Down Expand Up @@ -217,6 +218,7 @@
2170C28E292BB0BC005146C3 /* ExploreViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExploreViewController.swift; sourceTree = "<group>"; };
2170C290292C974B005146C3 /* ExploreViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExploreViewModel.swift; sourceTree = "<group>"; };
2170C292292CA689005146C3 /* RegionInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegionInfoView.swift; sourceTree = "<group>"; };
21723FB7293BA3800064255C /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../Desktop/GoogleService-Info.plist"; sourceTree = "<group>"; };
21862A902902675500518EBC /* GalleryDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GalleryDetailViewController.swift; sourceTree = "<group>"; };
21862A92290280BD00518EBC /* CardTransitionManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardTransitionManager.swift; sourceTree = "<group>"; };
218DA402290B1AA90089F896 /* LaunchScreenAnimationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LaunchScreenAnimationView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -597,6 +599,7 @@
isa = PBXGroup;
children = (
5FDC17D228FE7A900060DBB7 /* .swiftlint.yml */,
21723FB7293BA3800064255C /* GoogleService-Info.plist */,
5FDC17B928FE799C0060DBB7 /* Workade */,
5FDC17B828FE799C0060DBB7 /* Products */,
B7DE360250B0A3F5EC254C91 /* Pods */,
Expand Down Expand Up @@ -922,6 +925,7 @@
5FDC17D328FE7A900060DBB7 /* .swiftlint.yml in Resources */,
21F6DE5D28FFED5D00ED72C6 /* Pretendard-Regular.otf in Resources */,
2103BBA929261F4D00BBCB2C /* Satoshi-Medium.otf in Resources */,
21723FB8293BA3800064255C /* GoogleService-Info.plist in Resources */,
21F6DE5E28FFED5D00ED72C6 /* Pretendard-Bold.otf in Resources */,
5FDC17CA28FE799D0060DBB7 /* LaunchScreen.storyboard in Resources */,
21F6DE5C28FFED5D00ED72C6 /* Pretendard-SemiBold.otf in Resources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "applelogo.pdf",
"filename" : "􀣺.svg",
"idiom" : "universal"
}
],
Expand Down
Binary file not shown.
3 changes: 3 additions & 0 deletions Workade/Assets.xcassets/Login/applelogo.imageset/􀣺.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 28 additions & 13 deletions Workade/Views&ViewModels/Login/Element/LoginButtonView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,47 @@

import UIKit

enum LoginCase: String {
case apple
case google

var name: String {
switch self {
case .apple:
return "Apple"
case .google:
return "Google"
}
}
}

final class LoginButtonView: UIView {
var logoImage: UIImage?
var guideance: String
var loginCase: LoginCase

private let logoImageView: UIImageView = {
let logoImageView = UIImageView()
logoImageView.translatesAutoresizingMaskIntoConstraints = false

logoImageView.contentMode = .scaleAspectFit
return logoImageView
}()

private let textLabel: UILabel = {
let textLabel = UILabel()
textLabel.translatesAutoresizingMaskIntoConstraints = false
textLabel.font = .customFont(for: .footnote2)
textLabel.textColor = .black
textLabel.font = .systemFont(ofSize: 15, weight: .regular)

return textLabel
}()

init(logo: UIImage?, guideance: String) {
init(logo: UIImage?, loginCase: LoginCase) {
self.logoImage = logo
self.guideance = guideance
self.loginCase = loginCase
super.init(frame: .zero)

layer.cornerRadius = 20
backgroundColor = .theme.groupedBackground
layer.cornerRadius = 12
backgroundColor = loginCase == .apple ? .theme.primary : .theme.groupedBackground
textLabel.textColor = loginCase == .apple ? .theme.background : .theme.primary

setData()
setupLayout()
Expand All @@ -43,23 +57,24 @@ final class LoginButtonView: UIView {
fatalError("init(coder:) has not been implemented")
}

private func setupLayout() { addSubview(logoImageView)
private func setupLayout() {
addSubview(logoImageView)
NSLayoutConstraint.activate([
logoImageView.widthAnchor.constraint(equalToConstant: 24),
logoImageView.heightAnchor.constraint(equalToConstant: 24),
logoImageView.centerXAnchor.constraint(equalTo: self.centerXAnchor),
logoImageView.topAnchor.constraint(equalTo: self.topAnchor, constant: 22.5)
logoImageView.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 16),
logoImageView.centerYAnchor.constraint(equalTo: centerYAnchor)
])

addSubview(textLabel)
NSLayoutConstraint.activate([
textLabel.topAnchor.constraint(equalTo: logoImageView.bottomAnchor, constant: 20),
textLabel.centerYAnchor.constraint(equalTo: self.centerYAnchor),
textLabel.centerXAnchor.constraint(equalTo: self.centerXAnchor)
])
}

private func setData() {
logoImageView.image = logoImage
textLabel.text = guideance
textLabel.text = loginCase.name + "로 로그인"
}
}
39 changes: 20 additions & 19 deletions Workade/Views&ViewModels/Login/LoginSheetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ class LoginSheetView: UIView {
let logo = UIImageView()
logo.translatesAutoresizingMaskIntoConstraints = false
logo.image = UIImage(named: "workationlogo")
logo.contentMode = .scaleAspectFit

return logo
}()

private let guideLable: UILabel = {
private let guideLabel: UILabel = {
let guide = UILabel()
guide.translatesAutoresizingMaskIntoConstraints = false
guide.setLineHeight(lineHeight: 6)
Expand Down Expand Up @@ -48,14 +49,14 @@ class LoginSheetView: UIView {
}()

lazy var appleLoginButton: LoginButtonView = {
let loginButton = LoginButtonView(logo: UIImage(named: "applelogo"), guideance: "Apple로 게속하기")
let loginButton = LoginButtonView(logo: UIImage(named: "applelogo"), loginCase: .apple)
loginButton.translatesAutoresizingMaskIntoConstraints = false

return loginButton
}()

lazy var googleLoginButton: LoginButtonView = {
let loginButton = LoginButtonView(logo: UIImage(named: "googlelogo"), guideance: "Google로 계속하기")
let loginButton = LoginButtonView(logo: UIImage(named: "googlelogo"), loginCase: .google)
loginButton.translatesAutoresizingMaskIntoConstraints = false

return loginButton
Expand Down Expand Up @@ -84,10 +85,10 @@ class LoginSheetView: UIView {
logoImageView.heightAnchor.constraint(equalToConstant: 20)
])

addSubview(guideLable)
addSubview(guideLabel)
NSLayoutConstraint.activate([
guideLable.centerXAnchor.constraint(equalTo: self.centerXAnchor),
guideLable.topAnchor.constraint(equalTo: logoImageView.bottomAnchor, constant: 36.5)
guideLabel.centerXAnchor.constraint(equalTo: self.centerXAnchor),
guideLabel.topAnchor.constraint(equalTo: logoImageView.bottomAnchor, constant: 36.5)
])

addSubview(closeButton)
Expand All @@ -98,24 +99,24 @@ class LoginSheetView: UIView {
closeButton.bottomAnchor.constraint(equalTo: self.topAnchor, constant: 48) // 20 + 28
])

let appleTabGesture = UITapGestureRecognizer(target: self, action: #selector(handleAppleLogin))
appleLoginButton.addGestureRecognizer(appleTabGesture)
addSubview(appleLoginButton)
NSLayoutConstraint.activate([
appleLoginButton.topAnchor.constraint(equalTo: self.topAnchor, constant: 173),
appleLoginButton.trailingAnchor.constraint(equalTo: self.centerXAnchor, constant: -6),
appleLoginButton.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: 30),
appleLoginButton.bottomAnchor.constraint(equalTo: self.topAnchor, constant: 280)
])

let googleTabGesture = UITapGestureRecognizer(target: self, action: #selector(handleGoogleLogin))
googleLoginButton.addGestureRecognizer(googleTabGesture)
addSubview(googleLoginButton)
NSLayoutConstraint.activate([
googleLoginButton.topAnchor.constraint(equalTo: self.topAnchor, constant: 173),
googleLoginButton.leadingAnchor.constraint(equalTo: self.centerXAnchor, constant: 6),
googleLoginButton.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: -30),
googleLoginButton.bottomAnchor.constraint(equalTo: self.topAnchor, constant: 280)
googleLoginButton.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: 30),
googleLoginButton.heightAnchor.constraint(equalToConstant: 50)
])

let appleTabGesture = UITapGestureRecognizer(target: self, action: #selector(handleAppleLogin))
appleLoginButton.addGestureRecognizer(appleTabGesture)
addSubview(appleLoginButton)
NSLayoutConstraint.activate([
appleLoginButton.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: -30),
appleLoginButton.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: 30),
appleLoginButton.heightAnchor.constraint(equalToConstant: 50),
appleLoginButton.bottomAnchor.constraint(equalTo: self.layoutMarginsGuide.bottomAnchor, constant: 0),
appleLoginButton.topAnchor.constraint(equalTo: googleLoginButton.bottomAnchor, constant: 10)
])
}

Expand Down

0 comments on commit c76c480

Please sign in to comment.