damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit ee4cbf73637f3bfd3becdf12ad23f0aac3a5090d
parent a1b1ce949b75f679d8f7f9883061cae48cce6549
Author: Terry Yiu <git@tyiu.xyz>
Date:   Tue, 10 Dec 2024 19:45:43 -0500

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 <git@tyiu.xyz>

Diffstat:
Mdamus/Views/Buttons/GradientFollowButton.swift | 9+++++++--
Mdamus/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 @@ -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 @@ -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)) } }