Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions Handy/Handy-Storybook/Atom/TextFieldViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
//
// TextFieldViewController.swift
// Handy
//
// Created by 정민지 on 11/18/24.
//

import UIKit
import SnapKit

import Handy

final class TextFieldViewController: BaseViewController {

private let defaultField: HandyTextFieldView = {
let textField = HandyTextFieldView()
textField.placeholder = "Input text"
textField.fieldLabelText = "Label"
textField.helperLabelText = "Helper text"
return textField
}()

private let filledField: HandyTextFieldView = {
let textField = HandyTextFieldView()
textField.text = "Text Inputting"
textField.placeholder = "Input text"
textField.fieldLabelText = "Label"
textField.helperLabelText = "Helper text"
return textField
}()

private let errorField: HandyTextFieldView = {
let textField = HandyTextFieldView()
textField.placeholder = "Input text"
textField.fieldLabelText = "Label"
textField.helperLabelText = "Helper text"
textField.isNegative = true
return textField
}()

private let disabledField: HandyTextFieldView = {
let textField = HandyTextFieldView()
textField.placeholder = "Input text"
textField.fieldLabelText = "Label"
textField.helperLabelText = "Helper text"
textField.isDisabled = true
return textField
}()

override func viewDidLoad() {
super.viewDidLoad()
setViewLayouts()
}

override func setViewHierarchies() {
[
defaultField,
filledField,
errorField,
disabledField
].forEach {
view.addSubview($0)
}
}

override func setViewLayouts() {
defaultField.snp.makeConstraints {
$0.bottom.equalTo(filledField.snp.top).offset(-16)
$0.horizontalEdges.equalToSuperview().inset(20)
}
filledField.snp.makeConstraints {
$0.centerY.equalToSuperview().offset(-50)
$0.top.equalTo(defaultField.snp.bottom).offset(16)
$0.horizontalEdges.equalToSuperview().inset(20)
}
errorField.snp.makeConstraints {
$0.top.equalTo(filledField.snp.bottom).offset(16)
$0.horizontalEdges.equalToSuperview().inset(20)
}
disabledField.snp.makeConstraints {
$0.top.equalTo(errorField.snp.bottom).offset(16)
$0.horizontalEdges.equalToSuperview().inset(20)
}
}
}
79 changes: 79 additions & 0 deletions Handy/Handy-Storybook/Atom/TextViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
//
// TextViewController.swift
// Handy
//
// Created by 정민지 on 11/18/24.
//

import UIKit
import SnapKit

import Handy

final class TextViewController: BaseViewController {

private let defaultTextView: HandyTextView = {
let textView = HandyTextView()
textView.placeholder = "Input text"
textView.helperLabelText = "Helper text"
textView.placeholderColor = .lightGray
textView.minHeight = 187
textView.maxHeight = 187

return textView
}()


private let errorTextView: HandyTextView = {
let textView = HandyTextView()
textView.placeholder = "Input text"
textView.helperLabelText = "Helper text"
textView.placeholderColor = .lightGray
textView.isNegative = true
textView.maxHeight = 80

return textView
}()

private let disabledTextView: HandyTextView = {
let textView = HandyTextView()
textView.placeholder = "Input text"
textView.helperLabelText = "Helper text"
textView.placeholderColor = .lightGray
textView.isDisabled = true
textView.maxHeight = 187

return textView
}()


override func viewDidLoad() {
super.viewDidLoad()
setViewLayouts()
}

override func setViewHierarchies() {
[
defaultTextView, errorTextView, disabledTextView
].forEach {
view.addSubview($0)
}
}

override func setViewLayouts() {
defaultTextView.snp.makeConstraints {
$0.top.equalToSuperview().offset(100)
$0.horizontalEdges.equalToSuperview().inset(20)
}
errorTextView.snp.makeConstraints {
$0.top.equalTo(defaultTextView.snp.bottom).offset(20)
$0.horizontalEdges.equalToSuperview().inset(20)
}
disabledTextView.snp.makeConstraints {
$0.top.equalTo(errorTextView.snp.bottom).offset(20)
$0.horizontalEdges.equalToSuperview().inset(20)
}
}
}


48 changes: 48 additions & 0 deletions Handy/Handy.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@
02ED764C2C57BD09001569F1 /* HandyBoxButtonViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02ED764B2C57BD09001569F1 /* HandyBoxButtonViewController.swift */; };
2D41E8142C5A21930043161D /* FabViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D41E8132C5A21930043161D /* FabViewController.swift */; };
2D41E8162C5A21B50043161D /* HandyFab.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D41E8152C5A21B50043161D /* HandyFab.swift */; };
2D8811892D2642A900B0B517 /* HandyTextFieldView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D8811882D2642A800B0B517 /* HandyTextFieldView.swift */; };
2D88118B2D2642BD00B0B517 /* HandyTextFieldConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D88118A2D2642BC00B0B517 /* HandyTextFieldConstants.swift */; };
2D88118D2D2642CE00B0B517 /* HandyBaseTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D88118C2D2642CE00B0B517 /* HandyBaseTextField.swift */; };
2D88118F2D2642F900B0B517 /* TextFieldViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D88118E2D2642F900B0B517 /* TextFieldViewController.swift */; };
2D8811912D26512600B0B517 /* TextViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D8811902D26512500B0B517 /* TextViewController.swift */; };
2D8811942D26515100B0B517 /* HandyTextViewConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D8811932D26515000B0B517 /* HandyTextViewConstants.swift */; };
2D8811962D26516100B0B517 /* HandyTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D8811952D26516000B0B517 /* HandyTextView.swift */; };
2D8811982D26517100B0B517 /* HandyBaseTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D8811972D26517000B0B517 /* HandyBaseTextView.swift */; };
A56B3DE22C4E51D300C3610A /* HandyChip.swift in Sources */ = {isa = PBXBuildFile; fileRef = A56B3DE12C4E51D300C3610A /* HandyChip.swift */; };
A5A12A7E2C57A6D900996916 /* ChipViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5A12A7C2C57A6C200996916 /* ChipViewController.swift */; };
A5A12A7F2C57A92000996916 /* HandySematic.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5D02AFC2C46C5A70056CE7B /* HandySematic.swift */; };
Expand Down Expand Up @@ -115,6 +123,14 @@
02ED764B2C57BD09001569F1 /* HandyBoxButtonViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HandyBoxButtonViewController.swift; sourceTree = "<group>"; };
2D41E8132C5A21930043161D /* FabViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FabViewController.swift; sourceTree = "<group>"; };
2D41E8152C5A21B50043161D /* HandyFab.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HandyFab.swift; sourceTree = "<group>"; };
2D8811882D2642A800B0B517 /* HandyTextFieldView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HandyTextFieldView.swift; sourceTree = "<group>"; };
2D88118A2D2642BC00B0B517 /* HandyTextFieldConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HandyTextFieldConstants.swift; sourceTree = "<group>"; };
2D88118C2D2642CE00B0B517 /* HandyBaseTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HandyBaseTextField.swift; sourceTree = "<group>"; wrapsLines = 0; };
2D88118E2D2642F900B0B517 /* TextFieldViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFieldViewController.swift; sourceTree = "<group>"; };
2D8811902D26512500B0B517 /* TextViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextViewController.swift; sourceTree = "<group>"; };
2D8811932D26515000B0B517 /* HandyTextViewConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HandyTextViewConstants.swift; sourceTree = "<group>"; };
2D8811952D26516000B0B517 /* HandyTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HandyTextView.swift; sourceTree = "<group>"; };
2D8811972D26517000B0B517 /* HandyBaseTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HandyBaseTextView.swift; sourceTree = "<group>"; };
A56B3DE12C4E51D300C3610A /* HandyChip.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HandyChip.swift; sourceTree = "<group>"; };
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>"; };
Expand Down Expand Up @@ -173,6 +189,8 @@
2D41E8132C5A21930043161D /* FabViewController.swift */,
02ED764B2C57BD09001569F1 /* HandyBoxButtonViewController.swift */,
A5A12A7C2C57A6C200996916 /* ChipViewController.swift */,
2D8811902D26512500B0B517 /* TextViewController.swift */,
2D88118E2D2642F900B0B517 /* TextFieldViewController.swift */,
A5F6D36C2C97099C00FB961F /* DividerViewController.swift */,
E51FBF9A2C5399A00097B0DA /* CheckBoxViewController.swift */,
E51FBFA12C54CD350097B0DA /* RadioButtonViewController.swift */,
Expand Down Expand Up @@ -228,6 +246,8 @@
029E47FE2C49FD2E00D2F3B7 /* Atom */ = {
isa = PBXGroup;
children = (
2D8811922D26514B00B0B517 /* HandyTextView */,
2D8811872D26428500B0B517 /* HandyTextField */,
02ED762F2C52849A001569F1 /* HandyButton */,
029E47FC2C49FD1A00D2F3B7 /* HandyLabel.swift */,
2D41E8152C5A21B50043161D /* HandyFab.swift */,
Expand Down Expand Up @@ -313,6 +333,26 @@
path = Extension;
sourceTree = "<group>";
};
2D8811872D26428500B0B517 /* HandyTextField */ = {
isa = PBXGroup;
children = (
2D8811882D2642A800B0B517 /* HandyTextFieldView.swift */,
2D88118C2D2642CE00B0B517 /* HandyBaseTextField.swift */,
2D88118A2D2642BC00B0B517 /* HandyTextFieldConstants.swift */,
);
path = HandyTextField;
sourceTree = "<group>";
};
2D8811922D26514B00B0B517 /* HandyTextView */ = {
isa = PBXGroup;
children = (
2D8811932D26515000B0B517 /* HandyTextViewConstants.swift */,
2D8811972D26517000B0B517 /* HandyBaseTextView.swift */,
2D8811952D26516000B0B517 /* HandyTextView.swift */,
);
path = HandyTextView;
sourceTree = "<group>";
};
E5650D412C4D30B9002790CC /* Asset */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -455,6 +495,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2D88118F2D2642F900B0B517 /* TextFieldViewController.swift in Sources */,
02150E4C2CCABAEB00EE690E /* SnackbarViewController.swift in Sources */,
2D41E8142C5A21930043161D /* FabViewController.swift in Sources */,
A5A12A812C57A93C00996916 /* HandyPrimitive.swift in Sources */,
Expand All @@ -468,6 +509,7 @@
E51FBFA22C54CD350097B0DA /* RadioButtonViewController.swift in Sources */,
E51FBF9B2C5399A00097B0DA /* CheckBoxViewController.swift in Sources */,
025776352C4EA98C00272EC6 /* AppDelegate.swift in Sources */,
2D8811912D26512600B0B517 /* TextViewController.swift in Sources */,
02697A262C99DDA30027A362 /* HansySwitchViewController.swift in Sources */,
025776372C4EA98C00272EC6 /* SceneDelegate.swift in Sources */,
);
Expand All @@ -484,8 +526,10 @@
02150E4A2CC8D7AB00EE690E /* HandySnackbar.swift in Sources */,
E5D02B002C480A180056CE7B /* HandyPrimitive.swift in Sources */,
E5D02AFD2C46C5A70056CE7B /* HandySematic.swift in Sources */,
2D8811982D26517100B0B517 /* HandyBaseTextView.swift in Sources */,
E5D02B002C480A180056CE7B /* HandyPrimitive.swift in Sources */,
E51FBFA02C54CB260097B0DA /* HandyRadioButton.swift in Sources */,
2D88118B2D2642BD00B0B517 /* HandyTextFieldConstants.swift in Sources */,
E5669A3F2C443E7300DABC21 /* HandyBasicColor.swift in Sources */,
02ED76312C5284BB001569F1 /* HandyButtonProtocol.swift in Sources */,
02ED76352C5284F3001569F1 /* HandyTextButton.swift in Sources */,
Expand All @@ -494,10 +538,14 @@
02ED764A2C5779C3001569F1 /* UIImage+.swift in Sources */,
029E48002C49FD4000D2F3B7 /* HandyTypography.swift in Sources */,
E5650D432C4D326D002790CC /* HandyCheckBox.swift in Sources */,
2D8811962D26516100B0B517 /* HandyTextView.swift in Sources */,
2D88118D2D2642CE00B0B517 /* HandyBaseTextField.swift in Sources */,
029E47FD2C49FD1A00D2F3B7 /* HandyLabel.swift in Sources */,
A56B3DE22C4E51D300C3610A /* HandyChip.swift in Sources */,
2D8811942D26515100B0B517 /* HandyTextViewConstants.swift in Sources */,
E5650D472C512B07002790CC /* HandyIcon.swift in Sources */,
E5650D472C512B07002790CC /* HandyIcon.swift in Sources */,
2D8811892D2642A900B0B517 /* HandyTextFieldView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Loading