From b41205729e5d85e9c8a29a852db0a29c217013e1 Mon Sep 17 00:00:00 2001 From: Terry Yiu Date: Tue, 10 Dec 2024 19:45:43 -0500 Subject: [PATCH] Fix GradientFollowButton to have consistent width and autoscale text limited to 1 line Changelog-Fixed: Fixed GradientFollowButton to have consistent width and autoscale text limited to 1 line Signed-off-by: Terry Yiu --- damus/Views/Buttons/GradientFollowButton.swift | 9 +++++++-- damus/Views/Onboarding/SuggestedUserView.swift | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/damus/Views/Buttons/GradientFollowButton.swift b/damus/Views/Buttons/GradientFollowButton.swift index 2d130692..86b2dc17 100644 --- a/damus/Views/Buttons/GradientFollowButton.swift +++ b/damus/Views/Buttons/GradientFollowButton.swift @@ -29,13 +29,18 @@ struct GradientFollowButton: View { .fontWeight(.medium) .padding([.top, .bottom], 10) .padding([.leading, .trailing], 12) - .background(follow_state == .unfollows ? PinkGradient : GrayGradient) - .cornerRadius(12) .overlay( RoundedRectangle(cornerRadius: 12) .stroke(grayBorder, lineWidth: follow_state == .unfollows ? 0 : 1) + .frame(width: 100) ) + .frame(width: 100) + .minimumScaleFactor(0.5) + .lineLimit(1) } + .background(follow_state == .unfollows ? PinkGradient : GrayGradient) + .cornerRadius(12) + .frame(width: 100) .onReceive(handle_notify(.followed)) { ref in guard target.follow_ref == ref else { return } self.follow_state = .follows diff --git a/damus/Views/Onboarding/SuggestedUserView.swift b/damus/Views/Onboarding/SuggestedUserView.swift index b8de6623..3ef9b597 100644 --- a/damus/Views/Onboarding/SuggestedUserView.swift +++ b/damus/Views/Onboarding/SuggestedUserView.swift @@ -48,7 +48,10 @@ struct SuggestedUserView: View { .foregroundColor(.gray) .font(.caption) } + .frame(maxWidth: .infinity, alignment: .leading) + Spacer() + GradientFollowButton(target: target, follows_you: false, follow_state: damus_state.contacts.follow_state(target.pubkey)) } }