Skip to content

Commit

Permalink
Remove scenario title's line limit (#71)
Browse files Browse the repository at this point in the history
* Remove scenario title's line limit

* Use minimumScaleFactor
  • Loading branch information
ra1028 authored Jun 6, 2024
1 parent 782364d commit 54f3ea7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Sources/PlaybookUI/Internal/Views/GalleryThumbnail.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ private struct NameLabel: View {
content: data.scenario.title.rawValue,
range: data.highlightRange
)
.textStyle(font: .caption, lineLimit: 3)
.textStyle(font: .caption)
.minimumScaleFactor(0.1)
.padding(.top, 4)
.padding([.bottom, .horizontal], 8)
.frame(maxWidth: .infinity)
Expand Down
9 changes: 9 additions & 0 deletions Tests/GalleryScenarios.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ enum GalleryScenarios: ScenarioProvider {
Scenario("Detail", layout: .fill) { context in
GalleryDetail(data: .stub())
}

Scenario("Thumbnail with long title", layout: .compressed) { context in
GalleryThumbnail(
data: .stub(
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
)
)
.environmentObject(ImageLoader())
}
}
}
}
6 changes: 3 additions & 3 deletions Tests/Mocks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ extension SelectData {
}

extension SearchedData {
static func stub(_ index: Int) -> Self {
static func stub(_ title: ScenarioTitle) -> Self {
SearchedData(
category: "Category",
scenario: .stub("Scenario \(index)"),
scenario: .stub(title),
highlightRange: nil
)
}
}

extension SearchedCategoryData {
static func stub(
scenarios: [SearchedData] = (0..<3).map { .stub($0) }
scenarios: [SearchedData] = (0..<3).map { .stub("Scenario \($0)") }
) -> Self {
SearchedCategoryData(
category: "Category",
Expand Down

0 comments on commit 54f3ea7

Please sign in to comment.