vertical chapters are full width and max 3 lines

This commit is contained in:
Toni Förster 2023-11-27 14:18:43 +01:00
parent 3feafc153c
commit fb5cd0f681
No known key found for this signature in database
GPG Key ID: 292F3E5086C83FC7
2 changed files with 15 additions and 12 deletions

View File

@ -49,14 +49,14 @@ struct ChapterView: View {
}
VStack(alignment: .leading, spacing: 4) {
Text(chapter.title)
.lineLimit(2)
.lineLimit(3)
.multilineTextAlignment(.leading)
.font(.headline)
Text(chapter.start.formattedAsPlaybackTime(allowZero: true) ?? "")
.font(.system(.subheadline).monospacedDigit())
.foregroundColor(.secondary)
}
.frame(maxWidth: Self.thumbnailWidth, alignment: .leading)
.frame(maxWidth: !chapter.image.isNil ? Self.thumbnailWidth : nil, alignment: .leading)
}
}
#endif

View File

@ -16,7 +16,7 @@ struct ChaptersView: View {
var body: some View {
if !chapters.isEmpty {
if expand || chaptersHaveImages {
if chaptersHaveImages {
#if os(tvOS)
List {
Section {
@ -28,19 +28,22 @@ struct ChaptersView: View {
}
.listStyle(.plain)
#else
if chaptersHaveImages {
ScrollView(.horizontal) {
LazyHStack(spacing: 20) {
ForEach(chapters) { chapter in
ChapterView(chapter: chapter)
}
ScrollView(.horizontal) {
LazyHStack(spacing: 20) {
ForEach(chapters) { chapter in
ChapterView(chapter: chapter)
}
.padding(.horizontal, 15)
}
} else {
contents
.padding(.horizontal, 15)
}
#endif
} else if expand {
Section {
ForEach(chapters) { chapter in
ChapterView(chapter: chapter)
}
}
.padding(.horizontal)
} else {
#if os(iOS)
Button(action: {