diff --git a/Threaded/Components/ButtonStyles.swift b/Threaded/Components/ButtonStyles.swift index b559796..9c2b3ae 100644 --- a/Threaded/Components/ButtonStyles.swift +++ b/Threaded/Components/ButtonStyles.swift @@ -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)) diff --git a/Threaded/Views/PostingView.swift b/Threaded/Views/PostingView.swift index 517f45d..70d5791 100644 --- a/Threaded/Views/PostingView.swift +++ b/Threaded/Views/PostingView.swift @@ -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() }