mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-19 08:03:50 +02:00
Update ReactionsMenuButton UI
This commit is contained in:
@@ -18,7 +18,14 @@ import UIKit
|
||||
|
||||
class ReactionsMenuButton: UIButton, Themable {
|
||||
|
||||
// MARK: Private
|
||||
// MARK: - Constants
|
||||
|
||||
private enum Constants {
|
||||
static let borderWidthSelected: CGFloat = 1/UIScreen.main.scale
|
||||
static let borderColorAlpha: CGFloat = 0.15
|
||||
}
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
private var theme: Theme!
|
||||
|
||||
@@ -38,8 +45,8 @@ class ReactionsMenuButton: UIButton, Themable {
|
||||
|
||||
override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
self.layer.cornerRadius = self.frame.size.height / 2
|
||||
self.layer.borderWidth = self.isSelected ? 1 : 0
|
||||
self.layer.cornerRadius = self.frame.size.height / 3
|
||||
self.layer.borderWidth = self.isSelected ? Constants.borderWidthSelected : 0
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
@@ -59,16 +66,15 @@ class ReactionsMenuButton: UIButton, Themable {
|
||||
|
||||
func update(theme: Theme) {
|
||||
self.theme = theme
|
||||
|
||||
// TODO: Color for black theme
|
||||
|
||||
self.setTitleColor(self.theme.textPrimaryColor, for: .normal)
|
||||
self.setTitleColor(self.theme.textPrimaryColor, for: .selected)
|
||||
|
||||
self.layer.borderColor = self.theme.tintColor.cgColor
|
||||
self.layer.borderColor = self.theme.tintColor.withAlphaComponent(Constants.borderColorAlpha).cgColor
|
||||
}
|
||||
|
||||
private func updateView() {
|
||||
backgroundColor = isSelected ? self.theme.tintBackgroundColor : self.theme.headerBackgroundColor
|
||||
backgroundColor = isSelected ? self.theme.tintBackgroundColor : UIColor.clear
|
||||
}
|
||||
|
||||
override open var isSelected: Bool {
|
||||
|
||||
Reference in New Issue
Block a user