Skip to content

Commit

Permalink
[#6] HandyCheckBox 테스트 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
hye0njuoo committed Oct 9, 2024
1 parent 44b5b19 commit 76d11c3
Show file tree
Hide file tree
Showing 13 changed files with 114 additions and 14 deletions.
34 changes: 34 additions & 0 deletions Handy/Handy-Storybook/Atom/CheckBoxViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// CheckBoxViewController.swift
// Handy-Storybook
//
// Created by 성현주 on 7/26/24.
//

import Handy

final class CheckBoxViewController: BaseViewController {

let checkBox = HandyCheckBox()

override func viewDidLoad() {
super.viewDidLoad()

checkBox.isDisabled = true
checkBox.text = nil
checkBox.size = .large
checkBox.text = "ddd"
}

override func setViewHierarchies() {
self.view.addSubview(checkBox)
}

override func setViewLayouts() {
checkBox.snp.makeConstraints {
$0.center.equalToSuperview()
}
}
}


2 changes: 1 addition & 1 deletion Handy/Handy-Storybook/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(frame: UIScreen.main.bounds)
window?.windowScene = windowScene
window?.rootViewController = DividerViewController()
window?.rootViewController = CheckBoxViewController()
window?.makeKeyAndVisible()
}

Expand Down
9 changes: 8 additions & 1 deletion Handy/Handy.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
A5A12A822C57A93F00996916 /* HandyBasicColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5669A3E2C443E7300DABC21 /* HandyBasicColor.swift */; };
A5F6D36B2C96F32D00FB961F /* HandyDivider.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5F6D36A2C96F32D00FB961F /* HandyDivider.swift */; };
A5F6D36D2C97099C00FB961F /* DividerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5F6D36C2C97099C00FB961F /* DividerViewController.swift */; };
E51FBF9B2C5399A00097B0DA /* CheckBoxViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E51FBF9A2C5399A00097B0DA /* CheckBoxViewController.swift */; };
E51FBF9C2C539BC10097B0DA /* HandyBasicColor.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E5669A422C443FE500DABC21 /* HandyBasicColor.xcassets */; };
E51FBF9D2C539BC30097B0DA /* HandyIcon.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E5650D442C4E366F002790CC /* HandyIcon.xcassets */; };
E5650D432C4D326D002790CC /* HandyCheckBox.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5650D422C4D326D002790CC /* HandyCheckBox.swift */; };
E5650D452C4E366F002790CC /* HandyIcon.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E5650D442C4E366F002790CC /* HandyIcon.xcassets */; };
E5650D472C512B07002790CC /* HandyIcon.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5650D462C512B07002790CC /* HandyIcon.swift */; };
Expand Down Expand Up @@ -106,6 +109,7 @@
A5A12A7C2C57A6C200996916 /* ChipViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChipViewController.swift; sourceTree = "<group>"; };
A5F6D36A2C96F32D00FB961F /* HandyDivider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HandyDivider.swift; sourceTree = "<group>"; };
A5F6D36C2C97099C00FB961F /* DividerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DividerViewController.swift; sourceTree = "<group>"; };
E51FBF9A2C5399A00097B0DA /* CheckBoxViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckBoxViewController.swift; sourceTree = "<group>"; };
E5650D422C4D326D002790CC /* HandyCheckBox.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HandyCheckBox.swift; sourceTree = "<group>"; };
E5650D442C4E366F002790CC /* HandyIcon.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = HandyIcon.xcassets; sourceTree = "<group>"; };
E5650D462C512B07002790CC /* HandyIcon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HandyIcon.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -157,6 +161,7 @@
02ED764B2C57BD09001569F1 /* HandyBoxButtonViewController.swift */,
A5A12A7C2C57A6C200996916 /* ChipViewController.swift */,
A5F6D36C2C97099C00FB961F /* DividerViewController.swift */,
E51FBF9A2C5399A00097B0DA /* CheckBoxViewController.swift */,
);
path = Atom;
sourceTree = "<group>";
Expand Down Expand Up @@ -262,7 +267,6 @@
isa = PBXGroup;
children = (
02BDB7FB2C3E99920050FB67 /* HandyFont.swift */,
029E47FF2C49FD4000D2F3B7 /* HandyTypography.swift */,
E5669A3E2C443E7300DABC21 /* HandyBasicColor.swift */,
E5D02AFF2C480A180056CE7B /* HandyPrimitive.swift */,
E5D02AFC2C46C5A70056CE7B /* HandySematic.swift */,
Expand Down Expand Up @@ -407,6 +411,8 @@
files = (
025776412C4EA98E00272EC6 /* LaunchScreen.storyboard in Resources */,
0202B2562C58D8AF0017EAD8 /* HandyBasicColor.xcassets in Resources */,
E51FBF9D2C539BC30097B0DA /* HandyIcon.xcassets in Resources */,
E51FBF9C2C539BC10097B0DA /* HandyBasicColor.xcassets in Resources */,
025776562C4EB7BB00272EC6 /* Pretendard-SemiBold.otf in Resources */,
025776542C4EB7BB00272EC6 /* Pretendard-Regular.otf in Resources */,
025776592C4EB8BC00272EC6 /* Pretendard-Light.otf in Resources */,
Expand Down Expand Up @@ -442,6 +448,7 @@
025776392C4EA98C00272EC6 /* LabelViewController.swift in Sources */,
0257765D2C4EB9EF00272EC6 /* BaseViewController.swift in Sources */,
02ED764C2C57BD09001569F1 /* HandyBoxButtonViewController.swift in Sources */,
E51FBF9B2C5399A00097B0DA /* CheckBoxViewController.swift in Sources */,
025776352C4EA98C00272EC6 /* AppDelegate.swift in Sources */,
025776372C4EA98C00272EC6 /* SceneDelegate.swift in Sources */,
);
Expand Down
20 changes: 10 additions & 10 deletions Handy/Handy/Source/Atom/HandyCheckBox.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ public class HandyCheckBox: UIButton {
fileprivate var font: UIFont {
switch self {
case .small:
return HandyFont.B5Sb12
return HandyFont.B1Rg16
case .medium:
return HandyFont.B5Sb12
return HandyFont.B1Rg16
case .large:
return HandyFont.B5Sb12
return HandyFont.B1Rg16
}
}

Expand Down Expand Up @@ -129,19 +129,19 @@ public class HandyCheckBox: UIButton {
}

private func setIconImage() {
self.setImage(HandyIcon.icCancelFilled
self.setImage(HandyIcon.checkBoxSelected
.resize(to: size.iconSize)
.withRenderingMode(.alwaysTemplate),
.withRenderingMode(.automatic),
for: .selected)

self.setImage(HandyIcon.icCancelFilled
self.setImage(HandyIcon.checkBoxDisabled
.resize(to: size.iconSize)
.withRenderingMode(.alwaysTemplate),
for: UIControl.State.selected.union(.disabled))
.withRenderingMode(.automatic),
for: .disabled)

self.setImage(HandyIcon.icCancelLine
self.setImage(HandyIcon.checkBoxUnSelected
.resize(to: size.iconSize)
.withRenderingMode(.alwaysTemplate),
.withRenderingMode(.automatic),
for: .normal)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "checkBoxFilled.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "checkBoxSelected.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "checkBoxLine.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions Handy/Handy/Source/Foundation/HandyBasicColor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ internal extension UIColor {
// MARK: - Status

static var redMain: UIColor {
return UIColor.load(name: "red_main")
return UIColor.load(name: "r_main")
}

static var redSub: UIColor {
return UIColor.load(name: "red_sub")
return UIColor.load(name: "r_sub")
}
}

Expand Down
4 changes: 4 additions & 0 deletions Handy/Handy/Source/Foundation/HandyIcon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import UIKit
public enum HandyIcon {
public static var icCancelFilled: UIImage { .load(name: "icCancelFilled") }
public static var icCancelLine: UIImage { .load(name: "icCancelLine") }

public static var checkBoxUnSelected: UIImage { .load(name: "checkBoxUnSelected") }
public static var checkBoxSelected: UIImage { .load(name: "checkBoxSelected") }
public static var checkBoxDisabled: UIImage { .load(name: "checkBoxDisabled") }
}

extension UIImage {
Expand Down

0 comments on commit 76d11c3

Please sign in to comment.