Skip to content

Commit

Permalink
Fixed long name truncation in profile (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeShirley authored Jun 27, 2023
1 parent 9575fbf commit 2da6076
Showing 1 changed file with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct CommunitySidebarHeader : View {
CommunitySidebarHeaderAvatar(imageUrl: avatarUrl)

HStack {
Text(avatarSubtext)
Text(avatarSubtext).minimumScaleFactor(0.01)
}.foregroundColor(.gray)

}.padding([.leading])
Expand All @@ -59,8 +59,15 @@ struct CommunitySidebarHeader : View {
}.frame(width: .infinity, height: 16)
Spacer().frame(height: 20)

Text(title).font(.title).bold().lineLimit(1)
Text(subtitle).font(.footnote).lineLimit(1)
Text(title)
.font(.title)
.bold()
.lineLimit(1)
.minimumScaleFactor(0.01)
Text(subtitle)
.font(.footnote)
.lineLimit(1)
.minimumScaleFactor(0.01)

}.padding([.trailing])
}
Expand All @@ -72,10 +79,14 @@ struct CommunitySidebarHeader : View {
struct SidebarHeaderPreview: PreviewProvider {
static var previews: some View {
VStack {
CommunitySidebarHeader(title: "TestCommunity", subtitle: "@testcommunity@foo.bar",
CommunitySidebarHeader(title: "TestCommunityWithLongName", subtitle: "@testcommunity@longnamedomain.website",
avatarSubtext: "Created 3 days ago",
bannerURL: URL(string: "https://vlemmy.net/pictrs/image/719b61b3-8d8e-4aec-9f15-17be4a081f97.jpeg?format=webp"),
avatarUrl: URL(string: "https://vlemmy.net/pictrs/image/190f2d6a-ac38-448d-ae9b-f6d751eb6e69.png?format=webp"), label1: "Label 1", label2: "Label 2").border(.red)
avatarUrl: URL(string: "https://vlemmy.net/pictrs/image/190f2d6a-ac38-448d-ae9b-f6d751eb6e69.png?format=webp"), label1: "Label 1", label2: "Label 2")
CommunitySidebarHeader(title: "Test", subtitle: "@[email protected]",
avatarSubtext: "Created 3 days ago",
bannerURL: URL(string: "https://vlemmy.net/pictrs/image/719b61b3-8d8e-4aec-9f15-17be4a081f97.jpeg?format=webp"),
avatarUrl: URL(string: "https://vlemmy.net/pictrs/image/190f2d6a-ac38-448d-ae9b-f6d751eb6e69.png?format=webp"), label1: "Label 1", label2: "Label 2")
Spacer()
}
}
Expand Down

0 comments on commit 2da6076

Please sign in to comment.