-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from TeamCatchMe/feature/14-add-socialLoginButton
Feature/14 add social login button
- Loading branch information
Showing
29 changed files
with
296 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
// | ||
// CDSSocialButton.swift | ||
// | ||
// | ||
// Created by SHIN YOON AH on 2021/12/25. | ||
// | ||
|
||
#if !os(macOS) | ||
import UIKit | ||
import SnapKit | ||
|
||
/** | ||
- Description: | ||
|
||
CDS 소셜 로그인 버튼입니다. | ||
|
||
*/ | ||
|
||
public class CDSSocialButton: UIButton { | ||
|
||
// MARK: - Enum | ||
|
||
public enum SocialType { | ||
case kakao | ||
case naver | ||
case apple | ||
|
||
fileprivate var text: String { | ||
switch self { | ||
case .kakao: | ||
return "카카오 로그인" | ||
case .naver: | ||
return "네이버 로그인" | ||
case .apple: | ||
return "Apple로 로그인" | ||
} | ||
} | ||
|
||
fileprivate var background: UIColor { | ||
switch self { | ||
case .kakao: | ||
return CDSBaseColor.kakaoBackground | ||
case .naver: | ||
return CDSBaseColor.naverBackground | ||
case .apple: | ||
return CDSBaseColor.white | ||
} | ||
} | ||
|
||
fileprivate var foreground: UIColor { | ||
switch self { | ||
case .kakao, | ||
.apple: | ||
return .black | ||
case .naver: | ||
return .white | ||
} | ||
} | ||
|
||
fileprivate var icon: UIImage { | ||
switch self { | ||
case .kakao: | ||
return CDSIcon.icKakao | ||
case .naver: | ||
return CDSIcon.icNaver | ||
case .apple: | ||
return CDSIcon.icApple | ||
} | ||
} | ||
|
||
fileprivate var hoverIcon: UIImage { | ||
switch self { | ||
case .kakao: | ||
return CDSIcon.icKakaoHover | ||
case .naver: | ||
return CDSIcon.icNaverHover | ||
case .apple: | ||
return CDSIcon.icAppleHover | ||
} | ||
} | ||
} | ||
|
||
// MARK: - Private Properties | ||
|
||
private var type: SocialType = .kakao | ||
|
||
private var font: UIFont = CDSFont.body3 | ||
|
||
private var width: CGFloat = 335 | ||
|
||
private var height: CGFloat = 50 | ||
|
||
private var rounding: CGFloat = 12 | ||
|
||
// MARK: - Initalizing | ||
|
||
public init(type: SocialType) { | ||
super.init(frame: .zero) | ||
|
||
self.type = type | ||
|
||
setButtonConfiguration() | ||
setSize() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
// MARK: - Setting Method | ||
|
||
private func setButtonConfiguration() { | ||
setImage(type.icon, for: .normal) | ||
setImage(type.hoverIcon, for: .highlighted) | ||
|
||
setTitle(type.text, for: .normal) | ||
setTitleColor(type.foreground, for: .normal) | ||
setTitleColor(type.foreground.withAlphaComponent(0.5), for: .highlighted) | ||
|
||
backgroundColor = type.background | ||
|
||
self.layer.cornerRadius = rounding | ||
|
||
self.titleLabel?.font = font | ||
|
||
self.titleEdgeInsets = UIEdgeInsets(top: 0, left: 18, bottom: 0, right: 0) | ||
} | ||
|
||
private func setSize() { | ||
self.snp.makeConstraints { | ||
$0.height.equalTo(height) | ||
$0.width.equalTo(width) | ||
} | ||
} | ||
|
||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
CDSKit/Source/Foundation/CDSIcon.xcassets/icApple.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "ic_Apple.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+445 Bytes
CDSKit/Source/Foundation/CDSIcon.xcassets/icApple.imageset/ic_Apple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+777 Bytes
CDSKit/Source/Foundation/CDSIcon.xcassets/icApple.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.05 KB
CDSKit/Source/Foundation/CDSIcon.xcassets/icApple.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
CDSKit/Source/Foundation/CDSIcon.xcassets/icAppleHover.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "icAppleHover.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+425 Bytes
CDSKit/Source/Foundation/CDSIcon.xcassets/icAppleHover.imageset/icAppleHover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+755 Bytes
...it/Source/Foundation/CDSIcon.xcassets/icAppleHover.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1007 Bytes
...it/Source/Foundation/CDSIcon.xcassets/icAppleHover.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
CDSKit/Source/Foundation/CDSIcon.xcassets/icKakao.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "ic_Kakao.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+288 Bytes
CDSKit/Source/Foundation/CDSIcon.xcassets/icKakao.imageset/ic_Kakao.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+444 Bytes
CDSKit/Source/Foundation/CDSIcon.xcassets/icKakao.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+681 Bytes
CDSKit/Source/Foundation/CDSIcon.xcassets/icKakao.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
CDSKit/Source/Foundation/CDSIcon.xcassets/icKakaoHover.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "icKakaoHover.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+427 Bytes
CDSKit/Source/Foundation/CDSIcon.xcassets/icKakaoHover.imageset/icKakaoHover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+733 Bytes
...it/Source/Foundation/CDSIcon.xcassets/icKakaoHover.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.02 KB
...it/Source/Foundation/CDSIcon.xcassets/icKakaoHover.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
CDSKit/Source/Foundation/CDSIcon.xcassets/icNaver.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "ic_Naver.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+258 Bytes
CDSKit/Source/Foundation/CDSIcon.xcassets/icNaver.imageset/ic_Naver.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+434 Bytes
CDSKit/Source/Foundation/CDSIcon.xcassets/icNaver.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+454 Bytes
CDSKit/Source/Foundation/CDSIcon.xcassets/icNaver.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
CDSKit/Source/Foundation/CDSIcon.xcassets/icNaverHover.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "icNaverHover.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+314 Bytes
CDSKit/Source/Foundation/CDSIcon.xcassets/icNaverHover.imageset/icNaverHover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+484 Bytes
...it/Source/Foundation/CDSIcon.xcassets/icNaverHover.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+537 Bytes
...it/Source/Foundation/CDSIcon.xcassets/icNaverHover.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters