diff --git a/Escaper/Escaper/Common/Library/ColorPalette.swift b/Escaper/Escaper/Common/Library/ColorPalette.swift index d7b92c9..a0f09c7 100644 --- a/Escaper/Escaper/Common/Library/ColorPalette.swift +++ b/Escaper/Escaper/Common/Library/ColorPalette.swift @@ -10,6 +10,7 @@ import Foundation enum ColorPalette { case bloodyBlack case bloodyBurgundy + case bloodyDarkBurgundy case bloodyRed case charcoal case gloomyPink diff --git a/Escaper/Escaper/Domain/DataStruct/Genre.swift b/Escaper/Escaper/Domain/DataStruct/Genre.swift index 64e15fc..faa6ef0 100644 --- a/Escaper/Escaper/Domain/DataStruct/Genre.swift +++ b/Escaper/Escaper/Domain/DataStruct/Genre.swift @@ -7,7 +7,12 @@ import Foundation -enum Genre: String, Codable { +enum Genre: String, Tagable, CaseIterable, Codable { + + var name: String { + return self.rawValue + } + case all = "전체" case history = "역사" case fear = "공포" diff --git a/Escaper/Escaper/Domain/DataStruct/SortingOption.swift b/Escaper/Escaper/Domain/DataStruct/SortingOption.swift index e820571..2fecbaa 100644 --- a/Escaper/Escaper/Domain/DataStruct/SortingOption.swift +++ b/Escaper/Escaper/Domain/DataStruct/SortingOption.swift @@ -7,7 +7,7 @@ import Foundation -enum SortingOption: String { +enum SortingOption: String, Tagable, CaseIterable { case satisfaction = "만족도순" case level = "난이도순" case distance = "거리순" diff --git a/Escaper/Escaper/Domain/Protocol/Tagable.swift b/Escaper/Escaper/Domain/Protocol/Tagable.swift new file mode 100644 index 0000000..69678f2 --- /dev/null +++ b/Escaper/Escaper/Domain/Protocol/Tagable.swift @@ -0,0 +1,12 @@ +// +// Tagable.swift +// Escaper +// +// Created by shinheeRo on 2021/11/03. +// + +import Foundation + +protocol Tagable { + var name: String { get } +} diff --git a/Escaper/Escaper/Presentation/RoomList/Views/TagButton.swift b/Escaper/Escaper/Presentation/RoomList/Views/TagButton.swift new file mode 100644 index 0000000..23b1bed --- /dev/null +++ b/Escaper/Escaper/Presentation/RoomList/Views/TagButton.swift @@ -0,0 +1,44 @@ +// +// TagButton.swift +// Escaper +// +// Created by shinheeRo on 2021/11/03. +// + +import UIKit + +final class TagButton: UIButton { + + private(set) var element: Tagable? + + required init?(coder: NSCoder) { + super.init(coder: coder) + self.configure() + } + + override init(frame: CGRect) { + super.init(frame: frame) + self.configure() + } + + convenience init(element: Tagable) { + self.init(frame: .zero) + self.element = element + self.setTitle(element.name, for: .normal) + } + + private func configure() { + self.layer.cornerRadius = 5 + self.titleLabel?.textColor = UIColor(named: ColorPalette.skullWhite.code) + self.untouched() + } + + func touched() { + self.backgroundColor = UIColor(named: ColorPalette.pumpkin.code) + } + + func untouched() { + self.backgroundColor = UIColor(named: ColorPalette.bloodyDarkBurgundy.code) + } + +}