Skip to content

Commit cd930b5

Browse files
committed
[#55] TextField 관련 코드 정리 및 샘플 페이지 정리
1 parent 6fe69d3 commit cd930b5

15 files changed

Lines changed: 425 additions & 360 deletions

YDS-Storybook/AtomSampleViewController/PasswordTextFieldSampleViewController.swift

Lines changed: 0 additions & 74 deletions
This file was deleted.
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
//
2+
// PasswordTextFieldViewPageViewController.swift
3+
// YDS-Sample
4+
//
5+
// Created by Gyuni on 2021/08/23.
6+
//
7+
8+
import UIKit
9+
import YDS
10+
import SnapKit
11+
12+
class PasswordTextFieldViewPageViewController: StoryBookViewController {
13+
14+
let sampleTextFieldView: YDSPasswordTextFieldView = {
15+
let textFieldView = YDSPasswordTextFieldView()
16+
return textFieldView
17+
}()
18+
19+
override func viewDidLoad() {
20+
super.viewDidLoad()
21+
setupView()
22+
addOptions()
23+
}
24+
25+
private func setupView() {
26+
setViewProperty()
27+
setViewHierarchy()
28+
setAutolayout()
29+
}
30+
31+
private func setViewProperty() {
32+
self.title = "PasswordTextFieldView"
33+
self.sampleView.backgroundColor = YDSColor.bgNormal
34+
}
35+
36+
private func setViewHierarchy() {
37+
sampleView.addSubview(sampleTextFieldView)
38+
39+
}
40+
41+
private func setAutolayout() {
42+
sampleTextFieldView.snp.makeConstraints {
43+
$0.centerY.equalToSuperview()
44+
$0.leading.trailing.equalToSuperview().inset(20)
45+
}
46+
}
47+
48+
private func addOptions() {
49+
addOption(description: "fieldLabelText",
50+
defaultValue: "비밀번호") { [weak self] value in
51+
self?.sampleTextFieldView.fieldLabelText = value
52+
}
53+
54+
addOption(description: "placeholder",
55+
defaultValue: "1q2w3e4r!") { [weak self] value in
56+
self?.sampleTextFieldView.placeholder = value
57+
}
58+
59+
addOption(description: "helperLabelText",
60+
defaultValue: "숫자와 영문자 조합으로 8자 이상 입력해 주세요.") { [weak self] value in
61+
self?.sampleTextFieldView.helperLabelText = value
62+
}
63+
64+
addOption(description: "isDisabled",
65+
defaultValue: false) { [weak self] value in
66+
self?.sampleTextFieldView.isDisabled = value
67+
}
68+
69+
addOption(description: "isNegative",
70+
defaultValue: false) { [weak self] value in
71+
self?.sampleTextFieldView.isNegative = value
72+
}
73+
74+
addOption(description: "isPositive",
75+
defaultValue: false) { [weak self] value in
76+
self?.sampleTextFieldView.isPositive = value
77+
}
78+
}
79+
80+
81+
}
82+
83+
extension PasswordTextFieldViewPageViewController {
84+
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
85+
sampleTextFieldView.textField.endEditing(true)
86+
}
87+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
//
2+
// SearchBarPageViewController.swift
3+
// YDS-Sample
4+
//
5+
// Created by Gyuni on 2021/08/23.
6+
//
7+
8+
import UIKit
9+
import YDS
10+
import SnapKit
11+
12+
class SearchBarPageViewController: StoryBookViewController {
13+
14+
let sampleSearchBar: YDSSearchBar = {
15+
let searchBar = YDSSearchBar()
16+
return searchBar
17+
}()
18+
19+
override func viewDidLoad() {
20+
super.viewDidLoad()
21+
setupView()
22+
addOptions()
23+
self.extendedLayoutIncludesOpaqueBars = true
24+
self.navigationItem.titleView = sampleSearchBar
25+
}
26+
27+
private func setupView() {
28+
setViewProperty()
29+
}
30+
31+
private func setViewProperty() {
32+
self.title = "SearchBar"
33+
}
34+
35+
private func addOptions() {
36+
addOption(description: "placeholder",
37+
defaultValue: "검색어를 입력해주세요.") { [weak self] value in
38+
self?.sampleSearchBar.placeholder = value
39+
}
40+
41+
addOption(description: "isDisabled",
42+
defaultValue: false) { [weak self] value in
43+
self?.sampleSearchBar.isDisabled = value
44+
}
45+
}
46+
47+
}
48+
49+
extension SearchBarPageViewController {
50+
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
51+
sampleSearchBar.endEditing(true)
52+
}
53+
}

YDS-Storybook/AtomSampleViewController/SearchBarSampleViewController.swift

Lines changed: 0 additions & 56 deletions
This file was deleted.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
//
2+
// SearchTextFieldPageViewController.swift
3+
// YDS-Sample
4+
//
5+
// Created by Gyuni on 2021/08/23.
6+
//
7+
8+
import UIKit
9+
import YDS
10+
import SnapKit
11+
12+
class SearchTextFieldPageViewController: StoryBookViewController {
13+
14+
let sampleTextField: YDSSearchTextField = {
15+
let textField = YDSSearchTextField()
16+
return textField
17+
}()
18+
19+
override func viewDidLoad() {
20+
super.viewDidLoad()
21+
setupView()
22+
addOptions()
23+
}
24+
25+
private func setupView() {
26+
setViewProperty()
27+
setViewHierarchy()
28+
setAutolayout()
29+
}
30+
31+
private func setViewProperty() {
32+
self.title = "SearchTextField"
33+
self.sampleView.backgroundColor = YDSColor.bgNormal
34+
}
35+
36+
private func setViewHierarchy() {
37+
sampleView.addSubview(sampleTextField)
38+
39+
}
40+
41+
private func setAutolayout() {
42+
sampleTextField.snp.makeConstraints {
43+
$0.centerY.equalToSuperview()
44+
$0.leading.trailing.equalToSuperview().inset(20)
45+
}
46+
}
47+
48+
private func addOptions() {
49+
addOption(description: "placeholder",
50+
defaultValue: "검색어를 입력해주세요.") { [weak self] value in
51+
self?.sampleTextField.placeholder = value
52+
}
53+
54+
addOption(description: "isDisabled",
55+
defaultValue: false) { [weak self] value in
56+
self?.sampleTextField.isDisabled = value
57+
}
58+
}
59+
60+
61+
}
62+
63+
extension SearchTextFieldPageViewController {
64+
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
65+
sampleTextField.endEditing(true)
66+
}
67+
}

YDS-Storybook/AtomSampleViewController/SearchTextFieldSampleViewController.swift

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)