summaryrefslogtreecommitdiff
path: root/Jel/Views/Library/Item/ItemHeaderView.swift
blob: 1ff25c70006ab8fb9d43d29aa2704250f9b77301 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
//  ItemHeaderView.swift
//  Jel
//
//  Created by zerocool on 12/23/23.
//

import SwiftUI
import JellyfinKit

struct ItemHeaderView: View {
  @State var item: BaseItemDto
  
  let overlayGradient = LinearGradient(gradient: Gradient(stops: [
    .init(color: .clear, location: 0),
    .init(color: .black, location: 0.3),
    .init(color: .black, location: 0.7),
    .init(color: .clear, location: 1)
  ]), startPoint: .bottom, endPoint: .top)
  
  var body: some View {
    ZStack(alignment: .bottom) {
      LibraryIconView(library: item, imageType: "Backdrop", contentMode: .fill)
        .hideCaption()
        .setCornerRadius(0)
        .mask(overlayGradient)
        .padding(.top, 50)
        .background {
          LibraryIconView(library: item, imageType: "Backdrop", contentMode: .fill)
            .hideCaption()
            .setCornerRadius(0)
            .blur(radius: 50)
        }
      
      HStack {
        LibraryIconView(library: item, imageType: "Logo", width: 150)
          .hideCaption()
          .setCornerRadius(0)
          .shadow(radius: 10)
        Spacer()
      }
      .padding(.leading)
    }
  }
}

#Preview {
  ItemHeaderView(item: BaseItemDto())
}