summaryrefslogtreecommitdiff
path: root/Jel/Views/Library/LibraryIconView.swift
diff options
context:
space:
mode:
Diffstat (limited to 'Jel/Views/Library/LibraryIconView.swift')
-rw-r--r--Jel/Views/Library/LibraryIconView.swift41
1 files changed, 41 insertions, 0 deletions
diff --git a/Jel/Views/Library/LibraryIconView.swift b/Jel/Views/Library/LibraryIconView.swift
new file mode 100644
index 0000000..e5f42b0
--- /dev/null
+++ b/Jel/Views/Library/LibraryIconView.swift
@@ -0,0 +1,41 @@
+//
+// LibraryIconView.swift
+// Jel
+//
+// Created by zerocool on 12/15/23.
+//
+
+import SwiftUI
+import JellyfinKit
+
+struct LibraryIconView: View {
+ @EnvironmentObject var jellyfinClient: JellyfinClientController
+
+ @State var library: BaseItemDto
+
+ @State var loadingImage: Bool = true
+ @State var imageType: String = "Primary"
+ var width: CGFloat?
+ var height: CGFloat?
+
+ @State var loadedImageBinaryData: Data?
+
+ var body: some View {
+ VStack {
+ AsyncImageView(imageId: library.id ?? "",
+ blurhash: library.imageBlurHashes?.primary?[library.imageTags?[imageType] ?? ""] ?? "",
+ imageType: imageType)
+ .aspectRatio(contentMode: .fill)
+ .frame(width: width, height: height)
+ .clipShape(RoundedRectangle(cornerRadius: 5))
+
+
+ Text(library.name ?? "Unknown")
+ .font(.subheadline)
+ }
+ }
+}
+
+//#Preview {
+// LibraryIconView(library: BaseItemDto())
+//}