Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PLAYRTS-5553 Allow badge to expand horizontally if the contained text is long #493

Merged
merged 2 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Application/Sources/UI/Views/FeaturedContentCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private extension View {

struct FeaturedContentCell_Previews: PreviewProvider {
private static let kind: Mock.Media = .standard
private static let label = "New"
private static let label = "New label with long text, quite long"

static var previews: some View {
#if os(tvOS)
Expand All @@ -192,6 +192,10 @@ struct FeaturedContentCell_Previews: PreviewProvider {
FeaturedContentCell(media: Mock.media(kind), style: .show, label: label, layout: .element)
.previewLayout(for: .element, layoutWidth: 800, horizontalSizeClass: .compact)
.environment(\.horizontalSizeClass, .compact)
#endif

mutaben marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mutaben Regarding trim trailing whitespace on empty line discussion in #495, it's about this finding. On more I see from last months and from other PRs with our iOS developer colleagues 🍎😊.

FeaturedContentCell(media: Mock.media(kind), style: .show, label: label, layout: .element)
.previewLayout(for: .element, layoutWidth: 320, horizontalSizeClass: .compact)
.environment(\.horizontalSizeClass, .compact)
mutaben marked this conversation as resolved.
Show resolved Hide resolved
#endif
}
}
8 changes: 8 additions & 0 deletions Application/Sources/UI/Views/FeaturedDescriptionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ struct FeaturedDescriptionView<Content: FeaturedContent>: View, PrimaryColorSett
HStack(spacing: constant(iOS: 8, tvOS: 12)) {
if let label = content.label {
Badge(text: label, color: Color(.srgDarkRed))
.layoutPriority(1)
}
if let introduction = content.introduction {
Text(introduction)
Expand Down Expand Up @@ -107,5 +108,12 @@ struct FeaturedDescriptionView_Previews: PreviewProvider {
FeaturedDescriptionView(media: Mock.media(), style: .show, label: label, alignment: .center, detailed: true)
}
.previewLayout(.fixed(width: 800, height: 300))

Group {
FeaturedDescriptionView(media: Mock.media(), style: .show, label: label, alignment: .leading, detailed: true)
FeaturedDescriptionView(media: Mock.media(), style: .show, label: label, alignment: .topLeading, detailed: true)
FeaturedDescriptionView(media: Mock.media(), style: .show, label: label, alignment: .center, detailed: true)
}
.previewLayout(.fixed(width: 300, height: 300))
}
}