Skip to content

Commit

Permalink
♻️ :: [#135] 먹젠 버튼 리펙토링
Browse files Browse the repository at this point in the history
CustopButton => MukgenButto 이름변경
타입지정으로 더 깔끔한 코드로 변경했습니다.
  • Loading branch information
Eunho0922 committed Jan 1, 2024
1 parent d0fbe98 commit b090abd
Showing 1 changed file with 13 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,25 @@ import UIKit
import SnapKit
import Then

open class CustomButton: UIButton {
open class MukgenButton: UIButton {

private let textLabel = UILabel().then {
$0.textAlignment = .center
$0.numberOfLines = 1
$0.font = UIFont.systemFont(ofSize: 15, weight: .bold)
$0.font = UIFont.systemFont(ofSize: 16, weight: .semibold)
}

public init(
title: String,
backgroundColor: UIColor,
titleColor: UIColor,
font: UIFont? = UIFont.systemFont(ofSize: 15, weight: .bold)
type: MukgenButtonType
) {
super.init(frame: .zero)

self.backgroundColor = backgroundColor
textLabel.text = title
textLabel.textColor = titleColor
textLabel.font = font

layer.cornerRadius = 10
textLabel.text = type.logoTitle
textLabel.textColor = type.titleColor
self.backgroundColor = type.backgroundColor
self.layer.cornerRadius = 10
self.layer.borderWidth = 1
self.layer.borderColor = type.borderColor?.cgColor

setupUI()
}
Expand All @@ -38,11 +35,10 @@ open class CustomButton: UIButton {
textLabel.snp.makeConstraints {
$0.centerX.centerY.equalToSuperview()
}

snp.makeConstraints {
$0.width.equalTo(353.0)
$0.height.equalTo(55.0)
}
}

public func buttonColorChange(color: UIColor = MukgenKitAsset.Colors.pointBase.color) {
self.backgroundColor = color
}
}

0 comments on commit b090abd

Please sign in to comment.