Skip to content

Commit

Permalink
๐Ÿ€[FEAT] TabbarButton ๊ตฌํ˜„ (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
joonBaek12 committed Nov 24, 2022
1 parent f21018f commit aeb7ab2
Show file tree
Hide file tree
Showing 3 changed files with 289 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ final class DetailViewController: UIViewController {
private let productUnderlineView = UIView()
private let deliveryUnderlineView = UIView()
private let availableUnderlineView = UIView()
private let tabbarButtonUnderlineView = UIView()
private let tabbarButtonSelectedUnderlineView = UIView()
private let productDetailUnderlineView = UIView()
private let recommendUnderlineView = UIView()
private let relatedUnderlineView = UIView()
Expand Down Expand Up @@ -218,6 +220,21 @@ final class DetailViewController: UIViewController {
$0.textColor = 0x2f2f2f.color
}

private let productDetailLabel = UILabel().then {
$0.font = .tittleSubhead1
$0.textColor = 0x8e8e8e.color
}

private let reviewLabel = UILabel().then {
$0.font = .tittleSubhead1
$0.textColor = 0x8e8e8e.color }

private let qAndALabel = UILabel().then {
$0.font = .tittleSubhead1
$0.textColor = 0x8e8e8e.color
}


private let rateImageView = UIImageView(image: UIImage(named: "starRate"))
private let singleStarImageView = UIImageView(image: UIImage(named: "star14X14"))
private let productImageView = UIImageView(image: UIImage(named: "detailView"))
Expand All @@ -227,15 +244,21 @@ final class DetailViewController: UIViewController {
//MARK: - Variables
var isSelected = true

var tagList = ["๋ฆฝ๋ฐค", "ํ•ธ๋“œํฌ๋ฆผ", "ํ‹ดํŠธ", "์ฟ ์…˜", "๋งˆ์ŠคํฌํŒฉ"]
var tagList = [
"๋ฆฝ๋ฐค",
"ํ•ธ๋“œํฌ๋ฆผ",
"ํ‹ดํŠธ",
"์ฟ ์…˜",
"๋งˆ์ŠคํฌํŒฉ"
]

var recommendList:[recommendModel] = [
var recommendList: [recommendModel] = [
recommendModel(name: "์•„์ด์†Œ์ด", description:"์—”์ ค ์•„์ฟ ์•„ ์ˆ˜๋ถ„ ์ง„์ • ํฌ๋ฆผ 150ml๋ชจ์ด์Šค์ถฐ๋‹ฅํ„ฐ ์žฅ/์ˆ˜/์ง„ ์ˆ˜๋ถ„ ์•ฐํ”Œ ๊ธฐํš" , productImage: "", price: "27,000"),
recommendModel(name: "์„ผ์นด", description: "ํผํŽ™ํŠธ ํœฉ ํŽ˜์ด์…œ ์œ„์‹œ 120g", productImage: "", price: "8,500"),
recommendModel(name: "๋ผ์šด๋“œ๋žฉ", description: "1025 ๋…๋„ ์•ฐํ”Œ 45g", productImage: "", price: "28,000")
]

var relateList:[relateModel] = [
var relateList: [relateModel] = [
relateModel(name: "ํ”ผ์ง€์˜ค๊ฒ”", description: "[ํ•œ์ •๊ธฐํš] AIํฌ๋ฆผ 100ml ๊ธฐํš", productImage: "", price: "27,000", discountRate: "23%"),
relateModel(name: "์—์ŠคํŠธ๋ผ", description: "์•„ํ† ๋ฒ ๋ฆฌ์–ด 365 ํ•˜์ด๋“œ๋กœ ์—์„ผ์Šค 200ml ", productImage: "", price: "21,600", discountRate: "32%"),
relateModel(name: "์•„๋ฒค๋Š", description: "์‹œ์นผํŒŒํŠธํ”Œ๋Ÿฌ์Šค ํฌ๋ฆผ 1+1 ๊ธฐํš", productImage: "", price: "19,310", discountRate: "5%")
Expand Down Expand Up @@ -345,6 +368,14 @@ extension DetailViewController {
stockLabel
)

tabbarButtonContainerView.addSubviews(
productDetailLabel,
reviewLabel,
qAndALabel,
tabbarButtonUnderlineView,
tabbarButtonSelectedUnderlineView
)

productDetailContainerView.addSubview(productImageView)

recommendContainerView.addSubviews(
Expand Down Expand Up @@ -650,6 +681,35 @@ extension DetailViewController {
$0.trailing.equalToSuperview()
}

//tabbarButtonContainerView
productDetailLabel.snp.makeConstraints {
$0.top.equalToSuperview().offset(20)
$0.leading.equalToSuperview().offset(15)
}

reviewLabel.snp.makeConstraints {
$0.top.equalTo(productDetailLabel)
$0.centerX.equalToSuperview()
}

qAndALabel.snp.makeConstraints {
$0.top.equalTo(productDetailLabel)
$0.trailing.equalToSuperview().offset(-14.9)
}

tabbarButtonUnderlineView.snp.makeConstraints {
$0.top.equalTo(productDetailLabel.snp.bottom).offset(12)
$0.leading.trailing.equalToSuperview()
$0.height.equalTo(1)
}

tabbarButtonSelectedUnderlineView.snp.makeConstraints {
$0.bottom.equalTo(tabbarButtonUnderlineView.snp.top)
$0.leading.trailing.equalTo(productDetailLabel)
$0.height.equalTo(2)

}

productImageView.snp.makeConstraints {
$0.edges.equalToSuperview()
}
Expand Down Expand Up @@ -738,6 +798,9 @@ extension DetailViewController {
self.relateLabel.text = "์ด ์ƒํ’ˆ์€ ์–ด๋– ์„ธ์š”?"
self.recommendLabel.text = "๋ฐฉ๊ธˆ ๋ณธ ๊ฒƒ๊ณผ ์œ ์‚ฌํ•œ ์ƒํ’ˆ์ด์—์š”"
self.purchaseLabel.text = "๊ตฌ๋งคํ•˜๊ธฐ"
self.productDetailLabel.text = "์ œํ’ˆ์ƒ์„ธ"
self.reviewLabel.text = "๋ฆฌ๋ทฐ"
self.qAndALabel.text = "Q&A"
}

private func viewConfig() {
Expand All @@ -750,6 +813,8 @@ extension DetailViewController {
availableGreenUnderlineView.backgroundColor = 0xa4d232.color
separatelineView.backgroundColor = 0xebebeb.color
purchaseView.backgroundColor = 0xa4d232.color
tabbarButtonUnderlineView.backgroundColor = 0xebebeb.color
tabbarButtonSelectedUnderlineView.backgroundColor = 0x2f2f2f.color
}

private func configDelegate() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
////
//// EmptyViewController.swift
//// Oliveyoung-iOS
////
//// Created by Joon Baek on 2022/11/24.
////
//
//import UIKit
//
//import Then
//import SnapKit
//import SwiftyColor
//
////MARK: - EmptyViewController
//final class EmptyViewController: UIViewController {
//
// //MARK: - Lazy Components
// private lazy var scrollView = UIScrollView()
//
// private lazy var relateCollectionView: UICollectionView = {
// let layout = UICollectionViewFlowLayout()
// layout.scrollDirection = .vertical
//
// let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
// collectionView.backgroundColor = .clear
// collectionView.translatesAutoresizingMaskIntoConstraints = false
// collectionView.isScrollEnabled = true
// collectionView.showsVerticalScrollIndicator = false
// return collectionView
// }()
//
// //MARK: - UI Components
//
// private let topContainerView = UIView()
// private let emptyContainerView = UIView()
// private let emptyUnderlineView = UIView()
// private let recommendContainerView = UIView()
//
// private let textField = UITextField().then {
// $0.borderColor = 0xa4d232.color
// $0.cornerRadius = 19
// }
//
// private let backButton = UIButton().then {
// $0.setImage(UIImage(named: "back"), for: .normal)
// }
//
// private let searchButton = UIButton().then {
// $0.setImage(UIImage(named: "searchIcon24X24"), for: .normal)
// }
//
// private let errorImageView = UIImageView().then {
// $0.image = UIImage(named: "error")
// }
//
// private let errorLabel = UILabel().then {
// $0.font = .tittleHeadline
// $0.textColor = 0x2f2f2f.color
// $0.text = "๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค."
// }
//
// private let relateLabel = UILabel().then {
// $0.font = .tittleSubhead1
// $0.textColor = 0x2f2f2f.color
// $0.text = "์ด ๊ฒ€์ƒ‰์–ด๋Š” ์–ด๋– ์„ธ์š”?"
// }
//
// //MARK: - Variables
// var recommendList: [searchModel] = [
// searchModel(name: "๋ฆฝ๋ฐค"),
// searchModel(name: "ํ•ธ๋“œํฌ๋ฆผ"),
// searchModel(name: "ํ‹ดํŠธ"),
// searchModel(name: "์ฟ ์…˜"),
// searchModel(name: "๋งˆ์ŠคํฌํŒฉ"),
// searchModel(name: "ํ–ฅ์ˆ˜"),
// searchModel(name: "๋ฆฝ๋ฐค"),
// searchModel(name: "ํ•ธ๋“œํฌ๋ฆผ"),
// searchModel(name: "ํ‹ดํŠธ"),
// searchModel(name: "์ฟ ์…˜"),
// searchModel(name: "๋งˆ์ŠคํฌํŒฉ"),
// searchModel(name: "ํ–ฅ์ˆ˜")
// ]
//
// //MARK: - Life Cycles
// override func viewDidLoad() {
// super.viewDidLoad()
// layout()
// }
//}
//
////MARK: - Extensions
//extension EmptyViewController {
//
// //MARK: - Layout Helpers
// private func layout() {
// view.addSubviews(topContainerView, scrollView)
//
// scrollView.addSubviews(
// emptyContainerView,
// emptyUnderlineView,
// recommendContainerView
// )
//
// topContainerView.addSubviews(
// backButton,
// textField,
// searchButton
// )
//
// textField.addSubview(searchButton)
//
// emptyContainerView.addSubviews(
// errorImageView,
// errorLabel
// )
//
// recommendContainerView.addSubviews(
// relateLabel,
// relateCollectionView
// )
//
// topContainerView.snp.makeConstraints {
// $0.top.leading.trailing.equalTo(view.safeAreaLayoutGuide)
// $0.height.equalTo(36)
// }
//
// scrollView.snp.makeConstraints {
// $0.top.equalTo(topContainerView.snp.bottom)
// $0.leading.trailing.bottom.equalTo(view.safeAreaLayoutGuide)
// }
//
// //containerViews
// emptyContainerView.snp.makeConstraints {
// $0.top.equalToSuperview()
// $0.leading.trailing.equalToSuperview()
// $0.height.equalTo(<#T##other: ConstraintRelatableTarget##ConstraintRelatableTarget#>)
// }
//
// emptyUnderlineView.snp.makeConstraints {
//
// }
//
// recommendContainerView.snp.makeConstraints {
//
// }
//
// //topContainerView
// backButton.snp.makeConstraints {
// $0.centerY.equalToSuperview()
// $0.leading.equalToSuperview().offset(28)
// $0.width.equalTo(18)
// $0.height.equalTo(16)
// }
//
// textField.snp.makeConstraints {
// $0.centerY.equalToSuperview()
// $0.leading.equalTo(backButton.snp.trailing).offset(14)
// $0.trailing.equalToSuperview().offset(28)
// $0.height.equalToSuperview()
// }
//
// searchButton.snp.makeConstraints {
// $0.centerY.equalToSuperview()
// $0.trailing.equalToSuperview().offset(-12)
// $0.width.height.equalTo(20)
// }
//
// errorImageView.snp.makeConstraints {
// $0.top.equalToSuperview().offset(200.5)
// $0.centerX.equalToSuperview()
// $0.width.height.equalTo(84.6)
// }
//
// errorLabel.snp.makeConstraints {
// $0.top.equalTo(errorImageView.snp.bottom).offset(35.1)
// $0.centerX.equalToSuperview()
// }
//
//
// }
//
// //MARK: - General Helpers
//
//}
//
////MARK: - UICollectionViewDelegateFlowLayout
//extension EmptyViewController: UICollectionViewDelegateFlowLayout {
// func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
// <#code#>
// }
//
// func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
// <#code#>
// }
//
// func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
// <#code#>
// }
//
// func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
// <#code#>
// }
//
//}
//
////MARK: -
//extension EmptyViewController: UICollectionViewDataSource{
// func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
// <#code#>
// }
//
// func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
// <#code#>
// }
//
//
//}
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ struct relateModel {
var price: String
var discountRate: String
}

struct searchModel {
var name: String
}

0 comments on commit aeb7ab2

Please sign in to comment.