Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 3 additions & 7 deletions DE/DE/Sources/Core/CommonUI/Cells/ReviewCollectionViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ public class ReviewCollectionViewCell: UICollectionViewCell {
$0.font = UIFont.pretendard(.medium, size: 16)
}

public lazy var score = UILabel().then {
$0.textColor = AppColor.purple100
$0.font = UIFont.pretendard(.semiBold, size: 16)
}
public lazy var score = UILabel()

public lazy var review = UILabel()

Expand Down Expand Up @@ -91,9 +88,8 @@ public class ReviewCollectionViewCell: UICollectionViewCell {

public func configure(model: WineReviewModel, isExpanded: Bool) {
AppTextStyle.KR.body1.apply(to: nickname, text: model.name, color: AppColor.gray100)

score.text = "โ˜… \(String(model.rating))"

AppTextStyle.KR.body2
.apply(to: score, text: "โ˜… \(String(model.rating))", color: AppColor.purple100)
AppTextStyle.KR.body3.apply(to: review, text: model.contents, color: AppColor.gray90)

if let data = model.createdAt.toFlexibleDotFormattedDate() {
Expand Down
15 changes: 8 additions & 7 deletions DE/DE/Sources/Core/CommonUI/View/CustomDropdownView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,26 +64,26 @@ public class CustomDropdownView: UIView {

private func setupDropdownMenu() {
dropdownMenu.backgroundColor = AppColor.white
dropdownMenu.layer.cornerRadius = 8
dropdownMenu.layer.shadowColor = AppColor.black.cgColor
dropdownMenu.layer.cornerRadius = 6
dropdownMenu.layer.shadowColor = UIColor(hex: "111111")?.cgColor
dropdownMenu.layer.shadowOpacity = 0.1
dropdownMenu.layer.shadowOffset = CGSize(width: 0, height: 2)
dropdownMenu.layer.shadowRadius = 8
dropdownMenu.layer.shadowOffset = CGSize(width: 0, height: 1)
dropdownMenu.layer.shadowRadius = 10
dropdownMenu.isHidden = true
dropdownMenu.alpha = 0.0
addSubview(dropdownMenu)

dropdownMenu.snp.makeConstraints {
$0.top.equalTo(dropdownButton.snp.bottom).offset(8)
$0.horizontalEdges.equalTo(dropdownButton).inset(5)
$0.trailing.equalTo(dropdownButton.snp.trailing).inset(16)
$0.height.equalTo(35 * options.count)
}

for (index, option) in options.enumerated() {
let optionLabel = UILabel()
optionLabel.text = option
optionLabel.textColor = AppColor.gray50
optionLabel.font = UIFont.pretendard(.medium, size: 12)
optionLabel.font = UIFont.pretendard(.semiBold, size: 12)
optionLabel.textAlignment = .left
optionLabel.isUserInteractionEnabled = true
optionLabel.tag = index
Expand All @@ -94,7 +94,8 @@ public class CustomDropdownView: UIView {

dropdownMenu.addSubview(optionLabel)
optionLabel.snp.makeConstraints {
$0.centerX.equalToSuperview()
$0.leading.equalToSuperview().inset(12)
$0.trailing.equalToSuperview().inset(12)
$0.height.equalTo(35)
if index == 0 {
$0.top.equalToSuperview()
Expand Down
9 changes: 5 additions & 4 deletions DE/DE/Sources/Core/CommonUI/View/EntireReviewView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ public class EntireReviewView: UIView {
$0.register(ReviewCollectionViewCell.self, forCellWithReuseIdentifier: ReviewCollectionViewCell.identifier)
$0.backgroundColor = .clear
$0.isScrollEnabled = true
$0.showsVerticalScrollIndicator = true
$0.showsVerticalScrollIndicator = false
$0.showsHorizontalScrollIndicator = false
}

public override init(frame: CGRect) {
Expand All @@ -36,13 +37,13 @@ public class EntireReviewView: UIView {
}

private func addComponents() {
[title, dropdownView, reviewCollectionView].forEach{ self.addSubview($0) }
addSubviews(title, dropdownView, reviewCollectionView)
}

private func constraints() {
title.snp.makeConstraints {
$0.top.equalTo(safeAreaLayoutGuide)
$0.horizontalEdges.equalTo(safeAreaLayoutGuide)
$0.leading.equalToSuperview().inset(24)
$0.height.equalTo(30)
}

Expand All @@ -53,7 +54,7 @@ public class EntireReviewView: UIView {
}

reviewCollectionView.snp.makeConstraints {
$0.top.equalTo(title.snp.bottom).offset(DynamicPadding.dynamicValue(20))
$0.top.equalTo(title.snp.bottom).offset(16)
$0.horizontalEdges.equalTo(safeAreaLayoutGuide).inset(24)
$0.bottom.equalToSuperview()
}
Expand Down
8 changes: 8 additions & 0 deletions DE/DE/Sources/Core/CommonUI/View/TitleWithBarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,12 @@ public class TitleWithBarView: UIView {
make.bottom.equalToSuperview()
}
}

public func setTitleColor(_ color: UIColor = AppColor.black) {
titleLabel.textColor = color
}

public func setSubTitleColor(_ color: UIColor = AppColor.black) {
subTitleLabel.textColor = color
}
}
8 changes: 8 additions & 0 deletions DE/DE/Sources/Core/CommonUI/View/TitleWithoutBarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,12 @@ public class TitleWithoutBarView: UIView {
$0.centerY.equalToSuperview()
}
}

public func setTitleColor(_ color: UIColor = AppColor.black) {
titleLabel.textColor = color
}

public func setSubTitleColor(_ color: UIColor = AppColor.black) {
subTitleLabel.textColor = color
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ class EntireReviewViewController: UIViewController, FirebaseTrackable {
var screenName: String = Tracking.VC.entireReviewVC

let navigationBarManager = NavigationBarManager()

var wineId: Int = 0
var wineName: String = ""
var vintage: Int? = nil

var reviewResults: [WineReviewModel] = []
let networkService = WineService()
private let errorHandler = NetworkErrorHandler()
Expand All @@ -28,38 +31,34 @@ class EntireReviewViewController: UIViewController, FirebaseTrackable {

addView()
constraints()
self.view.showColorBlockingView()
Task {
do {
try await callEntireReviewAPI(wineId: self.wineId, sortType: "์ตœ์‹ ์ˆœ", page: 0)
self.view.hideBlockingView()
} catch {
self.view.hideBlockingView()
errorHandler.handleNetworkError(error, in: self)
}
}
setupDropdownAction()
setupNavigationBar()
}

public override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.view.addSubview(indicator)
self.navigationController?.setNavigationBarHidden(false, animated: animated)
}

public override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
self.navigationController?.setNavigationBarHidden(true, animated: animated)

view.addSubview(indicator)
view.showColorBlockingView()
setupDropdownAction()
}

public override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
logScreenView(fileName: #file)

Task {
do {
try await callEntireReviewAPI(wineId: self.wineId, sortType: "์ตœ์‹ ์ˆœ", page: 0)
self.view.hideBlockingView()
} catch {
self.view.hideBlockingView()
errorHandler.handleNetworkError(error, in: self)
}
}
}

private func setupNavigationBar() {

navigationBarManager.addBackButton(
to: navigationItem,
target: self,
Expand All @@ -71,40 +70,35 @@ class EntireReviewViewController: UIViewController, FirebaseTrackable {
navigationController?.popViewController(animated: true)
}

private lazy var largeTitleLabel = UILabel().then {
let text = wineName
$0.numberOfLines = 0

let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.lineSpacing = 2

let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.pretendard(.semiBold, size: 24),
.paragraphStyle: paragraphStyle,
.foregroundColor: AppColor.black
]

$0.attributedText = NSAttributedString(string: text, attributes: attributes)
}
private let largeTitleLabel = UILabel()

private lazy var entireReviewView = EntireReviewView().then {
$0.reviewCollectionView.delegate = self
$0.reviewCollectionView.dataSource = self
}

private func addView() {
[largeTitleLabel, entireReviewView].forEach{ view.addSubview($0) }
view.addSubviews(largeTitleLabel, entireReviewView)

var displayText = wineName
if let vintage = vintage {
displayText += " \(vintage)"
}
largeTitleLabel.numberOfLines = 0
largeTitleLabel.lineBreakMode = .byCharWrapping

AppTextStyle.KR.body1.apply(to: largeTitleLabel, text: displayText, color: AppColor.gray70)
}

private func constraints() {
largeTitleLabel.snp.makeConstraints {
$0.horizontalEdges.equalTo(view.safeAreaLayoutGuide).inset(25)
$0.top.equalTo(view.safeAreaLayoutGuide).offset(10)
$0.horizontalEdges.equalToSuperview().inset(24)
$0.top.equalTo(view.safeAreaLayoutGuide).offset(8)
}

entireReviewView.snp.makeConstraints {
$0.top.equalTo(largeTitleLabel.snp.bottom).offset(36)
$0.horizontalEdges.equalTo(view.safeAreaLayoutGuide)
$0.top.equalTo(largeTitleLabel.snp.bottom).offset(8)
$0.horizontalEdges.equalToSuperview()
$0.bottom.equalTo(view.safeAreaLayoutGuide)
}
}
Expand Down
Loading