Reuse shared album cards across screens
This commit is contained in:
1 parent
85e3b3148e
commit
dd733e8e03
5 files changed
+67
-93
No files matched your search
@@ -162,28 +162,8 @@ struct LibraryView: View {
|
||||
}
|
||||
|
||||
private func recentAlbumCard(_ album: Album) -> some View {
|
||||
VStack(alignment: .leading, spacing: 5) {
|
||||
AlbumArtworkView(url: model.artworkURL(for: album))
|
||||
.frame(width: 170)
|
||||
Text(album.name)
|
||||
.font(.subheadline.weight(.medium))
|
||||
.lineLimit(2)
|
||||
.foregroundStyle(.primary)
|
||||
Text(artistNames(album.artists))
|
||||
.font(.footnote)
|
||||
.lineLimit(1)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
.frame(width: 170, alignment: .leading)
|
||||
.accessibilityElement(children: .combine)
|
||||
}
|
||||
|
||||
private func artistNames(_ references: [APIReference<Artist>]) -> String {
|
||||
let names = references.compactMap { reference -> String? in
|
||||
guard case .value(let artist) = reference else { return nil }
|
||||
return artist.name
|
||||
}
|
||||
return names.isEmpty ? "Unknown Artist" : names.joined(separator: ", ")
|
||||
AlbumCardView(album: album, artworkURL: model.artworkURL(for: album))
|
||||
.frame(width: 170, alignment: .topLeading)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user