Files
sodalive-ios/SodaLive/Sources/Chat/Talk/Room/Quota/ChatQuotaNoticeItemView.swift

88 lines
2.4 KiB
Swift

//
// ChatQuotaNoticeItemView.swift
// SodaLive
//
// Created by klaus on 9/2/25.
//
import SwiftUI
struct ChatQuotaNoticeItemView: View {
let onSelectAd: () -> Void
let onSelectCan10: () -> Void
let onSelectCan20: () -> Void
var body: some View {
VStack(spacing: 10) {
Button {
onSelectAd()
} label: {
Text(I18n.Chat.Room.quotaAdAction(chatCount: 5))
.appFont(size: 18, weight: .bold)
.foregroundColor(Color(hex: "263238"))
.frame(maxWidth: .infinity)
.padding(.vertical, 14)
}
.frame(maxWidth: .infinity)
.background(Color(hex: "FEF8E3"))
.cornerRadius(30)
.overlay {
RoundedRectangle(cornerRadius: 30)
.stroke(lineWidth: 1)
.foregroundColor(Color(hex: "F7CB50"))
}
.buttonStyle(.plain)
HStack(spacing: 8) {
Button {
onSelectCan10()
} label: {
canButtonLabel(can: 10, chatCount: 15)
}
.buttonStyle(.plain)
Button {
onSelectCan20()
} label: {
canButtonLabel(can: 20, chatCount: 40)
}
.buttonStyle(.plain)
}
}
}
private func canButtonLabel(can: Int, chatCount: Int) -> some View {
HStack(spacing: 4) {
Image("ic_can")
HStack(spacing: 0) {
Text("\(can)")
.appFont(size: 20, weight: .bold)
.foregroundColor(Color(hex: "263238"))
Text(" / \(I18n.Chat.Room.quotaChatCount(chatCount))")
.appFont(size: 20, weight: .medium)
.foregroundColor(Color(hex: "263238"))
}
}
.frame(maxWidth: .infinity)
.padding(.vertical, 12)
.background(Color(hex: "B5E7FA"))
.cornerRadius(30)
.overlay {
RoundedRectangle(cornerRadius: 30)
.stroke(lineWidth: 1)
.foregroundColor(Color.button)
}
}
}
#Preview {
ChatQuotaNoticeItemView(
onSelectAd: {},
onSelectCan10: {},
onSelectCan20: {}
)
}