Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions Classes/Issues/Merge/MergeButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,14 @@ final class MergeButton: UIView {
func configure(title: String, enabled: Bool, loading: Bool) {
isUserInteractionEnabled = enabled && !loading

switch (enabled, loading) {
case (false, false):
backgroundColor = Styles.Colors.Gray.light.color
alpha = 0.3

case (false , true):
backgroundColor = Styles.Colors.Gray.light.color.withAlphaComponent(0.2)
alpha = 0.3

case (true, true):
backgroundColor = Styles.Colors.Green.medium.color.withAlphaComponent(0.2)

case (true, false):
guard gradientLayer.superlayer == nil else { break }
backgroundColor = (enabled
? (loading ? Styles.Colors.Green.medium.color : .clear)
: Styles.Colors.Gray.light.color)
.withAlphaComponent(loading ? 0.2 : 1)
alpha = enabled ? 1 : 0.3

if enabled && !loading {
guard gradientLayer.superlayer == nil else { return }
gradientLayer.cornerRadius = layer.cornerRadius
gradientLayer.colors = [
UIColor.fromHex("34d058").cgColor,
Expand All @@ -108,6 +102,8 @@ final class MergeButton: UIView {
[mergeLabel, optionIconView, optionBorder, activityView].forEach {
bringSubview(toFront: $0)
}
} else {
gradientLayer.removeFromSuperlayer()
}

let titleColor = enabled ? .white : Styles.Colors.Gray.dark.color
Expand Down