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:
@@ -29,13 +29,18 @@ struct GradientFollowButton: View {
|
|||||||
.fontWeight(.medium)
|
.fontWeight(.medium)
|
||||||
.padding([.top, .bottom], 10)
|
.padding([.top, .bottom], 10)
|
||||||
.padding([.leading, .trailing], 12)
|
.padding([.leading, .trailing], 12)
|
||||||
.background(follow_state == .unfollows ? PinkGradient : GrayGradient)
|
|
||||||
.cornerRadius(12)
|
|
||||||
.overlay(
|
.overlay(
|
||||||
RoundedRectangle(cornerRadius: 12)
|
RoundedRectangle(cornerRadius: 12)
|
||||||
.stroke(grayBorder, lineWidth: follow_state == .unfollows ? 0 : 1)
|
.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
|
.onReceive(handle_notify(.followed)) { ref in
|
||||||
guard target.follow_ref == ref else { return }
|
guard target.follow_ref == ref else { return }
|
||||||
self.follow_state = .follows
|
self.follow_state = .follows
|
||||||
|
|||||||
@@ -48,7 +48,10 @@ struct SuggestedUserView: View {
|
|||||||
.foregroundColor(.gray)
|
.foregroundColor(.gray)
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
}
|
}
|
||||||
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
GradientFollowButton(target: target, follows_you: false, follow_state: damus_state.contacts.follow_state(target.pubkey))
|
GradientFollowButton(target: target, follows_you: false, follow_state: damus_state.contacts.follow_state(target.pubkey))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user