Skip to content

Commit

Permalink
[Feat] #6 - FeedbackWriteView 완성
Browse files Browse the repository at this point in the history
  • Loading branch information
yurim830 committed Oct 25, 2024
1 parent 2bdba1f commit 683696c
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions 35-seminar/Presentation/Week2/View/FeedbackWriteView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,21 @@
//

import UIKit
import SnapKit

class FeedbackWriteView: UIView {

// MARK: - Properties
private let titleLabel = UILabel()
let cancelButton = UIButton()
let sendButton = UIButton()

let tapToRateStarStackView = StarStackView()
private let tapToRateGuideLabel = SubtitleLabel()

let feedbackStackView = UIStackView()
let feedbackTitleTextField = UITextField()
let feedbackTextView = UITextView()

// MARK: - Methods
override init(frame: CGRect) {
Expand All @@ -24,14 +35,76 @@ class FeedbackWriteView: UIView {
}

private func setUI() {
self.backgroundColor = .systemBackground

titleLabel.configureLabel(size: 17, weight: .medium, text: "리뷰 작성하기")

cancelButton.configureButton(title: "취소", fontSize: 17, fontWeight: .regular, removeContentInsets: true)

sendButton.configureButton(title: "보내기", fontSize: 17, fontWeight: .medium, removeContentInsets: true)

tapToRateGuideLabel.configureLabel(color: .secondaryLabel, size: 10, weight: .regular, text: "별점을 탭하여 평가하기")

feedbackStackView.axis = .vertical
feedbackStackView.spacing = 10

feedbackTitleTextField.placeholder = "제목"
feedbackTitleTextField.setContentHuggingPriority(.defaultHigh, for: .vertical)

feedbackTextView.text = "리뷰(선택사항)"
feedbackTextView.textContainerInset = .zero
feedbackTextView.textContainer.lineFragmentPadding = 0
feedbackTextView.font = .systemFont(ofSize: 15, weight: .regular)
}

private func setHierarchy() {
[cancelButton, sendButton, titleLabel, tapToRateStarStackView, tapToRateGuideLabel, feedbackStackView].forEach {
self.addSubview($0)
}

[feedbackTitleTextField, feedbackTextView].forEach {
let border = BorderView()
feedbackStackView.addArrangedSubview(border)
feedbackStackView.addArrangedSubview($0)

border.snp.makeConstraints {
$0.horizontalEdges.equalToSuperview()
$0.height.equalTo(0.4)
}
}
}

private func setConstraints() {
titleLabel.snp.makeConstraints {
$0.centerX.equalToSuperview()
$0.top.equalToSuperview().offset(20)
}

cancelButton.snp.makeConstraints {
$0.leading.equalToSuperview().offset(20)
$0.top.equalTo(titleLabel)
}

sendButton.snp.makeConstraints {
$0.trailing.equalToSuperview().offset(-20)
$0.top.equalTo(titleLabel)
}

tapToRateStarStackView.snp.makeConstraints {
$0.top.equalTo(titleLabel.snp.bottom).offset(30)
$0.centerX.equalToSuperview()
$0.width.equalTo(200)
}

tapToRateGuideLabel.snp.makeConstraints {
$0.top.equalTo(tapToRateStarStackView.snp.bottom).offset(2)
$0.centerX.equalToSuperview()
}

feedbackStackView.snp.makeConstraints {
$0.top.equalTo(tapToRateGuideLabel.snp.bottom).offset(2)
$0.horizontalEdges.equalToSuperview().inset(20)
$0.bottom.equalTo(self.safeAreaLayoutGuide)
}
}
}

0 comments on commit 683696c

Please sign in to comment.