feat: 신규 홈 추가
This commit is contained in:
		
							
								
								
									
										86
									
								
								SodaLive/Sources/Content/ContentItemView.swift
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										86
									
								
								SodaLive/Sources/Content/ContentItemView.swift
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,86 @@
 | 
			
		||||
//
 | 
			
		||||
//  ContentItemView.swift
 | 
			
		||||
//  SodaLive
 | 
			
		||||
//
 | 
			
		||||
//  Created by klaus on 7/10/25.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
import SwiftUI
 | 
			
		||||
import Kingfisher
 | 
			
		||||
 | 
			
		||||
struct ContentItemView: View {
 | 
			
		||||
    
 | 
			
		||||
    let item: AudioContentMainItem
 | 
			
		||||
    
 | 
			
		||||
    var body: some View {
 | 
			
		||||
        VStack(alignment: .leading, spacing: 0) {
 | 
			
		||||
            ZStack(alignment: .top) {
 | 
			
		||||
                KFImage(URL(string: item.coverImageUrl))
 | 
			
		||||
                    .cancelOnDisappear(true)
 | 
			
		||||
                    .resizable()
 | 
			
		||||
                    .scaledToFill()
 | 
			
		||||
                    .frame(width: 168, height: 168, alignment: .top)
 | 
			
		||||
                    .cornerRadius(16)
 | 
			
		||||
                
 | 
			
		||||
                HStack(alignment: .top, spacing: 0) {
 | 
			
		||||
                    Text("신작")
 | 
			
		||||
                        .font(.custom(Font.medium.rawValue, size: 12))
 | 
			
		||||
                        .foregroundColor(.white)
 | 
			
		||||
                        .padding(.horizontal, 10)
 | 
			
		||||
                        .padding(.vertical, 3)
 | 
			
		||||
                        .background(
 | 
			
		||||
                            LinearGradient(
 | 
			
		||||
                                gradient: Gradient(stops: [
 | 
			
		||||
                                    .init(color: Color(hex: "0001B1"), location: 0.24),
 | 
			
		||||
                                    .init(color: Color(hex: "3B5FF1"), location: 1.0)
 | 
			
		||||
                                ]),
 | 
			
		||||
                                startPoint: .top,
 | 
			
		||||
                                endPoint: .bottom
 | 
			
		||||
                            )
 | 
			
		||||
                        )
 | 
			
		||||
                        .cornerRadius(16, corners: [.topLeft, .bottomRight])
 | 
			
		||||
                    
 | 
			
		||||
                    Spacer()
 | 
			
		||||
                    
 | 
			
		||||
                    if item.isPointAvailable {
 | 
			
		||||
                        Image("ic_point")
 | 
			
		||||
                            .padding(.top, 6)
 | 
			
		||||
                            .padding(.trailing, 6)
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
            Text(item.title)
 | 
			
		||||
                .font(.custom(Font.medium.rawValue, size: 18))
 | 
			
		||||
                .foregroundColor(.white)
 | 
			
		||||
                .multilineTextAlignment(.leading)
 | 
			
		||||
                .fixedSize(horizontal: false, vertical: true)
 | 
			
		||||
                .lineLimit(1)
 | 
			
		||||
                .padding(.horizontal, 6)
 | 
			
		||||
                .padding(.top, 8)
 | 
			
		||||
            
 | 
			
		||||
            
 | 
			
		||||
            Text(item.creatorNickname)
 | 
			
		||||
                .font(.custom(Font.medium.rawValue, size: 14))
 | 
			
		||||
                .foregroundColor(Color(hex: "78909C"))
 | 
			
		||||
                .lineLimit(1)
 | 
			
		||||
                .padding(.horizontal, 6)
 | 
			
		||||
                .padding(.top, 4)
 | 
			
		||||
        }
 | 
			
		||||
        .frame(width: 168)
 | 
			
		||||
        .onTapGesture { AppState.shared.setAppStep(step: .contentDetail(contentId: item.contentId)) }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#Preview {
 | 
			
		||||
    ContentItemView(
 | 
			
		||||
        item: AudioContentMainItem(
 | 
			
		||||
            contentId: 1,
 | 
			
		||||
            creatorId: 1,
 | 
			
		||||
            title: "동정개발일지",
 | 
			
		||||
            coverImageUrl: "https://cf.sodalive.net/audio_content_cover/5696/5696-cover-50066e61-6633-445b-9ae1-3749554d3f08-9514-1750756003835",
 | 
			
		||||
            creatorNickname: "오늘밤결제했습니다",
 | 
			
		||||
            isPointAvailable: true
 | 
			
		||||
        )
 | 
			
		||||
    )
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user