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>
This commit is contained in:
2024-12-10 19:45:43 -05:00
parent 2d7b77a7e0
commit b41205729e
2 changed files with 10 additions and 2 deletions

View File

@@ -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

View File

@@ -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))
}
}