sodalive-ios/SodaLive/Sources/Settings/Event/EventDetailView.swift

70 lines
2.3 KiB
Swift

//
// EventDetailView.swift
// SodaLive
//
// Created by klaus on 2023/08/10.
//
import SwiftUI
import Kingfisher
struct EventDetailView: View {
let event: EventItem
var body: some View {
BaseView {
GeometryReader { proxy in
VStack(spacing: 0) {
DetailNavigationBar(title: "이벤트 상세")
ScrollView(.vertical, showsIndicators: false) {
KFImage(URL(string: event.detailImageUrl!))
.resizable()
.scaledToFit()
}
Spacer()
if let link = event.link, link.count > 0, let url = URL(string: link), UIApplication.shared.canOpenURL(url) {
Text("이벤트 참여하기")
.font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(.white)
.padding(.vertical, 16)
.frame(width: screenSize().width - 26.7)
.background(Color(hex: "3e737c"))
.cornerRadius(10)
.padding(13.3)
.background(Color(hex: "222222"))
.cornerRadius(16.7, corners: [.topLeft, .topRight])
.onTapGesture {
UIApplication.shared.open(url)
}
}
if proxy.safeAreaInsets.bottom > 0 {
Rectangle()
.foregroundColor(Color(hex: "222222"))
.frame(width: proxy.size.width, height: 15.3)
}
}
.edgesIgnoringSafeArea(.bottom)
}
}
}
}
struct EventDetailView_Previews: PreviewProvider {
static var previews: some View {
EventDetailView(
event: EventItem(
id: 1,
thumbnailImageUrl: "",
detailImageUrl: "",
popupImageUrl: "",
link: "http://m.naver.com"
)
)
}
}