-
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.
[feat] emptyView μμ±
- Loading branch information
Showing
16 changed files
with
237 additions
and
1 deletion.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
iOS/traveline/Resources/Images.xcassets/Common/empty.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" : "Glyph_ undefined.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "Glyph_ undefined 1.png", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "Glyph_ undefined 2.png", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+2.54 KB
...raveline/Resources/Images.xcassets/Common/empty.imageset/Glyph_ undefined 1.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
+4.1 KB
...raveline/Resources/Images.xcassets/Common/empty.imageset/Glyph_ undefined 2.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
+1.4 KB
iOS/traveline/Resources/Images.xcassets/Common/empty.imageset/Glyph_ undefined.png
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
iOS/traveline/Resources/Images.xcassets/Common/errorCircle.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" : "Glyph_ undefined.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "Glyph_ undefined 1.png", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "Glyph_ undefined 2.png", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+2.63 KB
...ne/Resources/Images.xcassets/Common/errorCircle.imageset/Glyph_ undefined 1.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
+4.12 KB
...ne/Resources/Images.xcassets/Common/errorCircle.imageset/Glyph_ undefined 2.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
+1.47 KB
...line/Resources/Images.xcassets/Common/errorCircle.imageset/Glyph_ undefined.png
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
142 changes: 142 additions & 0 deletions
142
iOS/traveline/Sources/DesignSystem/View/TLEmptyView.swift
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,142 @@ | ||
// | ||
// TLEmptyView.swift | ||
// traveline | ||
// | ||
// Created by KiWoong Hong on 2024/01/12. | ||
// Copyright Β© 2024 traveline. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class TLEmptyView: UIView { | ||
|
||
enum EmptyViewType { | ||
case search | ||
case timeline | ||
|
||
var image: UIImage { | ||
switch self { | ||
case .search: | ||
return TLImage.Common.errorCircle | ||
case .timeline: | ||
return TLImage.Common.empty | ||
} | ||
} | ||
|
||
var firstText: String { | ||
switch self { | ||
case .search: | ||
return "κ²μ κ²°κ³Όκ° μμ΄μ!" | ||
case .timeline: | ||
return "μμ§ μμ±λ κΈμ΄ μμ΄μ!" | ||
} | ||
} | ||
|
||
var secondText: String { | ||
switch self { | ||
case .search: | ||
return "λ€λ₯Έ ν€μλλ‘ κ²μν΄λ³΄μΈμ :)" | ||
case .timeline: | ||
return "λλ§μ μ¬ν κ²½νμ 곡μ ν΄λ³΄μΈμ :)" | ||
} | ||
} | ||
|
||
var bottomConstants: CGFloat { | ||
switch self { | ||
case .search: | ||
return UIScreen.main.bounds.width | ||
case .timeline: | ||
return UIScreen.main.bounds.width / 3 * 2 | ||
} | ||
} | ||
} | ||
|
||
private enum Metric { | ||
static let imageToLabelSpacing: CGFloat = 16 | ||
static let labelToLabelSpacing: CGFloat = 12 | ||
} | ||
|
||
// MARK: - UI Components | ||
|
||
private let stackView: UIStackView = { | ||
let view = UIStackView() | ||
view.translatesAutoresizingMaskIntoConstraints = false | ||
view.axis = .vertical | ||
view.alignment = .center | ||
view.distribution = .fill | ||
|
||
return view | ||
}() | ||
|
||
private let imageView: UIImageView = { | ||
let view = UIImageView() | ||
view.translatesAutoresizingMaskIntoConstraints = false | ||
|
||
return view | ||
}() | ||
|
||
private let firstLabel: TLLabel = { | ||
let label = TLLabel(font: .subtitle2, color: TLColor.white) | ||
label.translatesAutoresizingMaskIntoConstraints = false | ||
|
||
return label | ||
}() | ||
|
||
private let secondLabel: TLLabel = { | ||
let label = TLLabel(font: .body2, color: TLColor.white) | ||
label.translatesAutoresizingMaskIntoConstraints = false | ||
|
||
return label | ||
}() | ||
|
||
// MARK: - properties | ||
|
||
private let emptyViewType: EmptyViewType | ||
|
||
// MARK: - initialize | ||
|
||
init(type: EmptyViewType) { | ||
self.emptyViewType = type | ||
super.init(frame: .zero) | ||
|
||
setupAttributes() | ||
setupLayout() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
} | ||
|
||
// MARK: - Setup Functions | ||
|
||
private extension TLEmptyView { | ||
|
||
func setupAttributes() { | ||
backgroundColor = TLColor.black | ||
imageView.image = emptyViewType.image | ||
firstLabel.setText(to: emptyViewType.firstText) | ||
secondLabel.setText(to: emptyViewType.secondText) | ||
} | ||
|
||
func setupLayout() { | ||
addSubview(stackView) | ||
stackView.addArrangedSubviews( | ||
imageView, | ||
firstLabel, | ||
secondLabel | ||
) | ||
|
||
NSLayoutConstraint.activate([ | ||
stackView.topAnchor.constraint(equalTo: imageView.topAnchor), | ||
stackView.leadingAnchor.constraint(equalTo: leadingAnchor), | ||
stackView.trailingAnchor.constraint(equalTo: trailingAnchor), | ||
stackView.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -emptyViewType.bottomConstants) | ||
]) | ||
|
||
stackView.setCustomSpacing(Metric.imageToLabelSpacing, after: imageView) | ||
stackView.setCustomSpacing(Metric.labelToLabelSpacing, after: firstLabel) | ||
} | ||
|
||
} |
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
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