mirror of
https://github.com/lumaa-dev/BubbleApp.git
synced 2025-01-01 11:37:40 +01:00
Grayed button when disabled
This commit is contained in:
parent
f36ce5ff96
commit
447fe8263b
@ -5,6 +5,15 @@ import SwiftUI
|
||||
struct LargeButton: ButtonStyle {
|
||||
var filled: Bool = false
|
||||
var height: CGFloat? = nil
|
||||
var disabled: Bool = false
|
||||
|
||||
private var fillColor: Color {
|
||||
if disabled {
|
||||
Color.gray
|
||||
} else {
|
||||
Color(uiColor: UIColor.label)
|
||||
}
|
||||
}
|
||||
|
||||
func makeBody(configuration: Configuration) -> some View {
|
||||
configuration.label
|
||||
@ -12,7 +21,7 @@ struct LargeButton: ButtonStyle {
|
||||
.padding(.vertical, height)
|
||||
.background {
|
||||
if filled {
|
||||
Color(uiColor: UIColor.label)
|
||||
fillColor
|
||||
}
|
||||
}
|
||||
.foregroundStyle(filled ? Color(uiColor: UIColor.systemBackground) : Color(uiColor: UIColor.label))
|
||||
|
@ -37,7 +37,7 @@ struct PostingView: View {
|
||||
VStack(alignment: .leading) {
|
||||
// MARK: Status main content
|
||||
VStack(alignment: .leading, spacing: 10) {
|
||||
Text(accountManager.forceAccount().username)
|
||||
Text("@\(accountManager.forceAccount().username)")
|
||||
.multilineTextAlignment(.leading)
|
||||
.bold()
|
||||
|
||||
@ -116,7 +116,7 @@ struct PostingView: View {
|
||||
}
|
||||
}
|
||||
.disabled(postingStatus || viewModel.postText.length <= 0)
|
||||
.buttonStyle(LargeButton(filled: true, height: 7.5))
|
||||
.buttonStyle(LargeButton(filled: true, height: 7.5, disabled: postingStatus || viewModel.postText.length <= 0))
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user