Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BookCover 엔티티 & MHBook 뷰 구현 #47

Merged
merged 13 commits into from
Nov 12, 2024
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ final class SceneDelegate: UIResponder, UIWindowSceneDelegate {
: HomeViewController()

let navigationController = UINavigationController(rootViewController: initialViewController)
navigationController.navigationBar.isHidden = true
window?.rootViewController = navigationController
window?.makeKeyAndVisible()
}
Expand Down
7 changes: 7 additions & 0 deletions MemorialHouse/MHDomain/MHDomain/Entity/BookColor.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
public enum BookColor {
case beige
case blue
case green
case orange
case pink
}
24 changes: 24 additions & 0 deletions MemorialHouse/MHDomain/MHDomain/Entity/BookCover.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import MHFoundation

public struct BookCover {
public let bookIdentifer = UUID()
public let title: String
public let imageURL: String
public let bookType: BookColor
public let category: String
public let favorite: Bool

public init(
title: String,
imageURL: String,
bookType: BookColor,
category: String,
favorite: Bool = false
) {
self.title = title
self.imageURL = imageURL
self.bookType = bookType
self.category = category
self.favorite = favorite
}
}
8 changes: 0 additions & 8 deletions MemorialHouse/MHDomain/MHDomain/Temp.swift

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ final class BookCreationViewController: UIViewController {
attributedTitle.font = UIFont.ownglyphBerry(size: 25)

button.setAttributedTitle(NSAttributedString(attributedTitle), for: .normal)
button.setTitleColor(.title, for: .normal)
button.setTitleColor(.mhTitle, for: .normal)
button.contentHorizontalAlignment = .left

return button
Expand All @@ -55,7 +55,7 @@ final class BookCreationViewController: UIViewController {
attributedTitle.font = UIFont.ownglyphBerry(size: 25)

button.setAttributedTitle(NSAttributedString(attributedTitle), for: .normal)
button.setTitleColor(.title, for: .normal)
button.setTitleColor(.mhTitle, for: .normal)

return button
}()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import UIKit
import MHFoundation
import MHDomain

final class MHBook: UIView {
// MARK: - Property
private let bookCoverImageView = UIImageView()
private let titleLabel = UILabel(style: .default)
private let targetImageView: UIImageView = {
let imageView = UIImageView()
imageView.contentMode = .scaleAspectFill
imageView.clipsToBounds = true

imageView.layer.shadowRadius = 4
imageView.layer.shadowOpacity = 0.4
imageView.layer.shadowOffset = CGSize(width: 4, height: 4)

return imageView
}()
private let publisherLabel = UILabel(style: .body2)

// MARK: - Initializer
init() {
super.init(frame: .zero)

configureAddSubView()
configureConstraints()
}

required init?(coder: NSCoder) {
super.init(coder: coder)

configureAddSubView()
configureConstraints()
}

// MARK: - Configuration
func configure(
title: String,
bookCoverImage: UIImage,
targetImage: UIImage,
publisher: String
) {
titleLabel.text = title
bookCoverImageView.image = bookCoverImage
targetImageView.image = targetImage
publisherLabel.text = publisher
}

private func configureAddSubView() {
addSubview(bookCoverImageView)
addSubview(titleLabel)
addSubview(targetImageView)
addSubview(publisherLabel)
}

private func configureConstraints() {
bookCoverImageView.fillSuperview()
titleLabel.setTop(anchor: topAnchor, constant: 16)
titleLabel.setCenterX(view: self, constant: 8)
targetImageView.setTop(anchor: titleLabel.bottomAnchor, constant: 14)
targetImageView.setCenterX(view: self, constant: 8)
targetImageView.setWidthAndHeight(width: 100, height: 100)
publisherLabel.setBottom(anchor: bottomAnchor, constant: 12)
publisherLabel.setTrailing(anchor: trailingAnchor, constant: 12)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import UIKit
import MHDomain

extension BookColor {
var image: UIImage {
switch self {
case .blue: .blueBook
case .beige: .beigeBook
case .green: .greenBook
case .orange: .orangeBook
case .pink: .pinkBook
default: .blueBook
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@ public extension UILabel {
enum Style {
case `default`
case header
case body
case body1
case body2
}

convenience init(style: Style) {
self.init(frame: .zero)
self.textColor = .title
self.textColor = .mhTitle
self.textAlignment = .center
switch style {
case .default:
self.font = UIFont.ownglyphBerry(size: 25)
case .header:
self.font = UIFont.ownglyphBerry(size: 30)
case .body:
case .body1:
self.font = UIFont.ownglyphBerry(size: 17)
case .body2:
self.font = UIFont.ownglyphBerry(size: 12)
}
}
}
Loading