summaryrefslogtreecommitdiff
path: root/Jel/Views/Library/Item/ItemHeaderView.swift
blob: 44be77666e33fdfa58241c663b0bd885390ed6fa (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
50
51
52
//
//  ItemHeaderView.swift
//  Jel
//
//  Created by zerocool on 12/23/23.
//

import SwiftUI
import JellyfinKit

struct ItemHeaderView: View {
  var item: BaseItemDto
  
  let overlayGradientMask = LinearGradient(gradient: Gradient(stops: [
    .init(color: .clear, location: 0),
    .init(color: .black, location: 0.3),
  ]), startPoint: .bottom, endPoint: .top)
  let overlayGradient = LinearGradient(gradient: Gradient(stops: [
    .init(color: .black, location: 0),
    .init(color: .clear, location: 0.5)
  ]), startPoint: .bottom, endPoint: .top)
  
  var body: some View {
    ZStack(alignment: .bottom) {
      StickyHeaderView(minHeight: 400) {
        ItemIconView(item: item, imageType: "Backdrop", contentMode: .fill)
          .setCornerRadius(0)
          .overlay(overlayGradient.opacity(0.8))
      }
      
      HStack {
        ItemIconView(item: item, imageType: "Logo", width: 200, height: 100, placeHolder: AnyView(Text(item.name ?? "Unknown").font(.title).bold().truncationMode(.middle)))
          .setCornerRadius(0)
          .shadow(radius: 10)
          .frame(alignment: .leading)
        Spacer()
        ItemInfoView(item: item)
      }
      .padding([.leading, .trailing])
    }
//    .scrollTransition {content, phase in
//      content
//        .scaleEffect(phase.isIdentity ? 1 : 2)
//        .opacity(phase.isIdentity ? 1 : 0.1)
//        .blur(radius: phase.isIdentity ? 0 : 50)
//    }
  }
}

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